Package: apt-listchanges
Version: 2.59
Tags: patch l10n

python2.3 gettext has a misfeature of encoding text
as .po file was encoded in, regardless of the current locale.

The following patch works around the problem by encoding
the text in the current locale.

For python2.4, gettext.lgettext will work as expected.



diff -ur apt-listchanges-2.59-orig/apt-listchanges 
apt-listchanges-2.59/apt-listchanges
--- apt-listchanges-2.59-orig/apt-listchanges   2004-11-14 10:34:08.000000000 
+0900
+++ apt-listchanges-2.59/apt-listchanges        2005-07-16 16:02:14.101763168 
+0900
@@ -29,6 +29,7 @@
 import sys
 import apt_pkg
 import gettext
+import locale
 import string
 import anydbm
 import DebianControlParser
@@ -37,7 +38,13 @@
 
 def main():
     try:
-        _ = gettext.translation('apt-listchanges').gettext
+        # This is for python 2.3 compatibility.
+        # Replace with "_ = gettext.translation('linda').lgettext" line for 
python2.4
+        gettext_encoding=locale.getpreferredencoding()
+        my_ugettext = gettext.translation('linda').ugettext
+        def lgettext(msgid):
+            return my_ugettext(msgid).encode(gettext_encoding)
+        _ = lgettext
     except IOError:
         _ = lambda str: str
 
Only in apt-listchanges-2.59: apt-listchanges.1
diff -ur apt-listchanges-2.59-orig/apt_listchanges.py 
apt-listchanges-2.59/apt_listchanges.py
--- apt-listchanges-2.59-orig/apt_listchanges.py        2005-02-14 
04:48:03.000000000 +0900
+++ apt-listchanges-2.59/apt_listchanges.py     2005-07-16 16:02:35.988435888 
+0900
@@ -23,7 +23,13 @@
 
 locale.setlocale(locale.LC_ALL,'')
 try:
-    _ = gettext.translation('apt-listchanges').gettext
+    # This is for python 2.3 compatibility.
+    # Replace with "_ = gettext.translation('apt-listchanges').lgettext" line 
for python2.4
+    gettext_encoding=locale.getpreferredencoding()
+    my_ugettext = gettext.translation('apt-listchanges').ugettext
+    def lgettext(msgid):
+        return my_ugettext(msgid).encode(gettext_encoding)
+    _ = lgettext
 except IOError:
     _ = lambda str: str
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to