diff options
author | fujiwarat <takao.fujiwara1@gmail.com> | 2012-05-08 13:13:49 +0900 |
---|---|---|
committer | fujiwarat <takao.fujiwara1@gmail.com> | 2012-05-22 10:39:45 +0900 |
commit | 10f68dbab4cc2af5c50731d7987f0b6a5601cf02 (patch) | |
tree | 105955eec293eae1691060193a9a55f9b697573c | |
parent | 430b07188d267420fe7f318617a5fdc30466d3a1 (diff) | |
download | ibus-anthy-10f68dbab4cc2af5c50731d7987f0b6a5601cf02.tar.gz |
Fixed GtkBuilder bindtextdomain in ibus-setup.
-rw-r--r-- | setup/main.py | 22 | ||||
-rw-r--r-- | setup/setup.ui | 4 |
2 files changed, 19 insertions, 7 deletions
diff --git a/setup/main.py b/setup/main.py index f725b89..0ee846e 100644 --- a/setup/main.py +++ b/setup/main.py @@ -23,12 +23,14 @@ from os import environ, getuid, path import os, sys -from gettext import dgettext, bindtextdomain +import locale +import gettext +from gettext import dgettext try: from locale import getpreferredencoding except: - pass + getpreferredencoding = None from gi.repository import Gtk from gi.repository import Gdk @@ -38,6 +40,7 @@ from gi.repository import IBus import _config as config from anthyprefs import AnthyPrefs +DOMAINNAME = 'ibus-anthy' _ = lambda a : dgettext('ibus-anthy', a) def l_to_s(l): @@ -49,10 +52,18 @@ def s_to_l(s): class AnthySetup(object): def __init__(self): - bindtextdomain('ibus-anthy', config.LOCALEDIR) + # Python's locale module doesn't provide all methods on some + # operating systems like FreeBSD + try: + locale.bindtextdomain(DOMAINNAME, config.LOCALEDIR) + locale.bind_textdomain_codeset(DOMAINNAME, 'UTF-8') + except AttributeError: + pass + gettext.bindtextdomain(DOMAINNAME, config.LOCALEDIR) + gettext.bind_textdomain_codeset(DOMAINNAME, 'UTF-8') builder_file = path.join(path.dirname(__file__), 'setup.ui') self.__builder = builder = Gtk.Builder() - builder.set_translation_domain('ibus-anthy') + builder.set_translation_domain(DOMAINNAME) builder.add_from_file(builder_file) if IBus.get_address() == None: @@ -197,7 +208,8 @@ class AnthySetup(object): about_dialog.set_version(self.prefs.get_version()) try: - if getpreferredencoding().lower() == 'utf-8': + if getpreferredencoding != None and \ + getpreferredencoding().lower() == 'utf-8': copyright = about_dialog.get_copyright() copyright = copyright.replace('(c)', '\xc2\xa9') copyright = copyright.replace('-', '\xe2\x80\x93') diff --git a/setup/setup.ui b/setup/setup.ui index 3997ade..caeb969 100644 --- a/setup/setup.ui +++ b/setup/setup.ui @@ -2672,8 +2672,8 @@ <property name="program-name">IBus-Anthy</property> <property name="copyright">Copyright (c) 2007-2008 Peng Huang Copyright (c) 2009 Hideaki ABE -Copyright (c) 2009-2010 Takao Fujiwara -Copyright (c) 2007-2010 Red Hat, Inc.</property> +Copyright (c) 2009-2012 Takao Fujiwara +Copyright (c) 2007-2012 Red Hat, Inc.</property> <property name="comments" translatable="yes">The Anthy engine for IBus input platform</property> <property name="license">GPL</property> <property name="website">http://code.google.com/p/ibus/</property> |