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

python's gettext.gettext broken, use gettext.lgettext


While I was hacking at debconf, I noticed that 
python's gettext function returns strings encoded in the 
original encoding; which will appear as garbage on 
the screen.

With python2.4, lgettext is added, which seems to do
the right thing and return the string encoded in the 
current CODESET.

#318578 (linda), #318581 (apt-listchanges) is a workaround
 for 2.3, which looks slightly large, but workable.

+    gettext_encoding=locale.getpreferredencoding()
+    my_ugettext = gettext.translation('apt-listchanges').ugettext
+    def lgettext(msgid):
+        return my_ugettext(msgid).encode(gettext_encoding)
+    _ = lgettext

Correct me if I'm missing something, since python is not 
my best language.


Junichi Uekawa, Debian Developer   http://www.netfort.gr.jp/~dancer/
183A 70FC 4732 1B87 57A5  CE82 D837 7D4E E81E 55C1 

Reply to: