GNOME Bugzilla – Bug 343081
Python plugin translation not working
Last modified: 2006-06-26 02:30:27 UTC
The following add a couple of files to POTFILES.in so that it can be translatable. However python plugin í8n is not working (I doubt because the lack of binddomaintext). Tested with vi.po
Created attachment 66314 [details] [review] i18n patch
I've committed the patch to cvs, thanks. I'll have a chat with the gedit/ephy plugin people to see if they have any ideas about why python plugins aren't getting translated (our code is nased on those). Bumping up severity, since i18n not working correctly is fairly important.
With that patch, intltool-update would fail and require to prepend [encoding: UTF-8] in POTFILES.in. I found out that it's because some *.rb-plugin.desktop.in contain utf-8 code.
With the "[encoding: UTF-8]" bit fixed, does this still occur with cvs?
Still
Changing patch state since it got committed already. I have no idea why this isn't working correctly.
To test, I added these lines to lyrics.py from gettext import bindtextdomain, bind_textdomain_codeset, textdomain bindtextdomain("rhythmbox", "/home/pclouds/local/rb/share/locale") bind_textdomain_codeset ("rhythmbox", "UTF-8") textdomain ("rhythmbox") Now lyric plugin shows Vietnamese perfectly. GETTEXT_PACKAGE and GNOMELOCALEDIR are not available to python plugins. Besides I don't like writing these function calls in every plugins. So it would be best calling the functions from C although I'm not familiar with Python C API.
Created attachment 67947 [details] [review] python plugin i18n support With this patch, lyrics.py's translation works. I have no idea why gettext.install() doesn't work (even if I call it from lyrics.py). And moving gettext.textdomain() to rb-python-module.c doesn't work too :(
Forget about the last patch. If you remove "from gettext import gettext as _" from python sources, it will work. gettext.install() installs _() for you already.
Thanks for looking into this. I've changed all the python sources in cvs, if you can let us know whether that fixes it, it would be great.
works
Marking FIXED as per last comment.