make plugins translation work under windows.

This commit is contained in:
Yann Leboulanger 2011-09-02 19:41:09 +02:00
parent 6de00d1cc5
commit 2b11c7f8d9
2 changed files with 11 additions and 4 deletions

View file

@ -156,6 +156,11 @@ common.configpaths.gajimpaths.init_profile(profile)
del profile del profile
if os.name == 'nt': if os.name == 'nt':
plugins_locale_dir = str(os.path.join(common.configpaths.gajimpaths[
'PLUGINS_USER'], 'locale'))
libintl.bindtextdomain('gajim_plugins', plugins_locale_dir)
libintl.bind_textdomain_codeset('gajim_plugins', 'UTF-8')
class MyStderr(object): class MyStderr(object):
_file = None _file = None
_error = None _error = None

View file

@ -27,10 +27,12 @@ from common import gajim
APP = 'gajim_plugins' APP = 'gajim_plugins'
plugins_locale_dir = os_path.join(gajim.PLUGINS_DIRS[1], 'locale') plugins_locale_dir = os_path.join(gajim.PLUGINS_DIRS[1], 'locale')
if os.name != 'nt':
locale.setlocale(locale.LC_ALL, '') locale.setlocale(locale.LC_ALL, '')
locale.bindtextdomain(APP, plugins_locale_dir) locale.bindtextdomain(APP, plugins_locale_dir)
gettext.bindtextdomain(APP, plugins_locale_dir) gettext.bindtextdomain(APP, plugins_locale_dir)
gettext.textdomain(APP) gettext.textdomain(APP)
try: try:
t = gettext.translation(APP, plugins_locale_dir) t = gettext.translation(APP, plugins_locale_dir)
_ = t.gettext _ = t.gettext