1 """i18n and l10n support for git-cola"""
3 import gettext
as _gettext
7 from cola
import resources
9 _null_translation
= _gettext
.NullTranslations()
10 _translation
= _null_translation
14 return _translation
.ugettext(s
)
17 def ngettext(s
, p
, n
):
18 return _translation
.ungettext(s
, p
, n
)
27 if sys
.platform
== 'win32':
29 _translation
= _gettext
.translation('git-cola',
30 localedir
=_get_locale_dir(),
35 _translation
= _null_translation
38 def _get_locale_dir():
39 return resources
.prefix('share', 'locale')
42 def _check_win32_locale():
43 for i
in ('LANGUAGE','LC_ALL','LC_MESSAGES','LANG'):
52 # use only user's default locale
53 lang
= locale
.getdefaultlocale()[0]
55 # using ctypes to determine all locales
56 lcid_user
= ctypes
.windll
.kernel32
.GetUserDefaultLCID()
57 lcid_system
= ctypes
.windll
.kernel32
.GetSystemDefaultLCID()
58 if lcid_user
!= lcid_system
:
59 lcid
= [lcid_user
, lcid_system
]
62 lang
= [locale
.windows_locale
.get(i
) for i
in lcid
]
63 lang
= ':'.join([i
for i
in lang
if i
])
64 # set lang code for gettext
66 os
.environ
['LANGUAGE'] = lang
69 # additional strings for translation
77 # qcat titles for various file types
80 N_('View binary file')
84 N_("No changes selected to commit")
85 N_("No changes selected to revert")