summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2012-05-08 13:13:49 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2012-05-08 13:13:49 +0900
commitca10d184d1345c2943d2d0757bf7893d82825019 (patch)
treed9504698524dc6ac256f741f775ab8fadd3371d5
parente835629a970eb788f773038c6fc05aaf3bfc7835 (diff)
downloadibus-anthy-ca10d184d1345c2943d2d0757bf7893d82825019.tar.gz
Fixed GtkBuilder bindtextdomain in ibus-setup.
-rw-r--r--setup/main.py22
-rw-r--r--setup/setup.ui4
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>