File calibre-l18n.diff of Package calibre

diff -u '--exclude=*_ui.py' '--exclude=*.so' -r calibre.bak/src/calibre//translations/dynamic.py calibre/src/calibre//translations/dynamic.py
--- calibre.bak/src/calibre//translations/dynamic.py	2010-04-23 22:11:59.000000000 +0200
+++ calibre/src/calibre//translations/dynamic.py	2010-04-28 14:08:54.000000000 +0200
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 '''
 Dynamic language lookup of translations for user-visible strings.
 '''
@@ -8,8 +9,7 @@
 import os
 
 from gettext import GNUTranslations
-from calibre.utils.localization import get_lc_messages_path
-
+from calibre.utils.localization import get_lc_messages_path, CALIBRE_MO
 __all__ = ['translate']
 
 _CACHE = {}
@@ -21,7 +21,7 @@
     else:
         mpath = get_lc_messages_path(lang)
         if mpath is not None:
-            p = os.path.join(mpath, 'messages.mo')
+            p = os.path.join(mpath, CALIBRE_MO)
             if os.path.exists(p):
                 trans = GNUTranslations(open(p, 'rb'))
                 _CACHE[lang] = trans
diff -u '--exclude=*_ui.py' '--exclude=*.so' -r calibre.bak/src/calibre//utils/localization.py calibre/src/calibre//utils/localization.py
--- calibre.bak/src/calibre//utils/localization.py	2010-04-23 22:11:59.000000000 +0200
+++ calibre/src/calibre//utils/localization.py	2010-04-28 14:48:20.000000000 +0200
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
 from __future__ import with_statement
 
@@ -9,6 +10,7 @@
 import os, locale, re, cStringIO, cPickle
 from gettext import GNUTranslations
 
+CALIBRE_MO = "calibre.mo"
 _available_translations = None
 
 def available_translations():
@@ -45,7 +47,11 @@
     return lang
 
 def messages_path(lang):
-    return P('localization/locales/%s/LC_MESSAGES'%lang)
+    # return P('localization/locales/%s/LC_MESSAGES'%lang)
+    return '/usr/share/locale/%s/LC_MESSAGES' % lang
+
+def qt_message_path(lang):
+    return '/usr/share/qt4/translations'
 
 def get_lc_messages_path(lang):
     hlang = None
@@ -75,7 +81,7 @@
         mpath = get_lc_messages_path(lang)
         if mpath is not None:
             if buf is None:
-                buf = open(os.path.join(mpath, 'messages.mo'), 'rb')
+                buf = open(os.path.join(mpath, CALIBRE_MO), 'rb')
             mpath = mpath.replace(os.sep+'nds'+os.sep, os.sep+'de'+os.sep)
             isof = os.path.join(mpath, 'iso639.mo')
             if os.path.exists(isof):
@@ -138,9 +144,9 @@
     if lang is not None:
         if lang == 'nds':
             lang = 'de'
-        mpath = get_lc_messages_path(lang)
-        if mpath is not None:
-            p = os.path.join(mpath, 'qt.qm')
+        qtpath = qt_message_path(lang)
+        if qtpath is not None:
+            p = os.path.join(qtpath, 'qt_%s.qm' % lang)
             if os.path.exists(p):
                 return translator.load(p)
     return False
Nur in calibre/src/calibre//utils: localization.py~.
openSUSE Build Service is sponsored by