Module: deluge
Branch: master
Commit: 80e480854e1992e360a1e8412180a79dcac9deeb

Author: John Garland <[email protected]>
Date:   Fri Apr 16 00:07:40 2010 +1000

Fix fsize by initialising gettext

---

 deluge/common.py |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/deluge/common.py b/deluge/common.py
index ae42208..c41fe7d 100644
--- a/deluge/common.py
+++ b/deluge/common.py
@@ -64,6 +64,24 @@ if not hasattr(json, "dumps"):
 
 import pkg_resources
 import xdg, xdg.BaseDirectory
+import gettext
+import locale
+
+# Initialize gettext
+try:
+    if hasattr(locale, "bindtextdomain"):
+        locale.bindtextdomain("deluge", 
pkg_resources.resource_filename("deluge", "i18n"))
+    if hasattr(locale, "textdomain"):
+        locale.textdomain("deluge")
+    gettext.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", 
"i18n"))
+    gettext.textdomain("deluge")
+    gettext.install("deluge", pkg_resources.resource_filename("deluge", 
"i18n"))
+except Exception, e:
+    from deluge.log import LOG as log
+    log.error("Unable to initialize gettext/locale!")
+    log.exception(e)
+    import __builtin__
+    __builtin__.__dict__["_"] = lambda x: x
 
 from deluge.error import *
 

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to