[hamster-applet/gnome-2-30] bug 614452 - load translations in standalone mode



commit 24e68f176220653bb162324045b2481dda96b55b
Author: Frédéric Péters <fpeters 0d be>
Date:   Wed Mar 31 13:01:27 2010 +0100

    bug 614452 - load translations in standalone mode

 src/hamster-standalone |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/hamster-standalone b/src/hamster-standalone
index 0e96469..14c7d7e 100755
--- a/src/hamster-standalone
+++ b/src/hamster-standalone
@@ -21,6 +21,8 @@
 
 import logging
 import datetime as dt
+import gettext, locale
+import os.path
 
 import gtk
 
@@ -519,6 +521,17 @@ class ProjectHamster(object):
         gtk.main_quit()
 
 if __name__ == "__main__":
+    from hamster import defs
+
+    # Setup i18n
+    locale_dir = os.path.abspath(os.path.join(defs.DATA_DIR, "locale"))
+    for module in (gettext, locale):
+        module.bindtextdomain('hamster-applet', locale_dir)
+        module.textdomain('hamster-applet')
+
+        if hasattr(module, 'bind_textdomain_codeset'):
+            module.bind_textdomain_codeset('hamster-applet','UTF-8')
+
     gtk.gdk.threads_init()
     app = ProjectHamster()
     gtk.main()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]