gettext again

stasz foo at bar.org
Sun Aug 7 16:44:09 EDT 2005


On Sun, 07 Aug 2005 21:33:21 +0200, cantabile wrote:

> stasz a écrit :
>> On Sun, 07 Aug 2005 11:09:14 +0200, cantabile wrote:
>> 
>> 
>>>Hi,
>>>I'm failing to make it work but can't find out what's wrong. Here's what 
>>>I do :
>> 
>> [....]
>> 
>>>How come ? What's wrong with what I am doing ?
>> 
>> Start with this little howto about gettext.
>> http://childsplay.sourceforge.net/translate-howto.html
>> 
>> And then do this in your test.py:
>> http://www.python.org/doc/2.4.1/lib/node330.html
>> 
>> You should read the part about gettext in the Python Library Reference
>> it's really good :-)
>> 
>> Good luck,
>> Stas Z
>> 
>> 
> 
> Well, I must be dumb, because I did exactly that and it still doesn't 
> work...
> 
> BTW, I have no pygettext module. I asked here and somebody said it was 
> deprecated and now included in xgettext.
> And I've read the Python doc about gettext about ten times, but it seems 
> quite outdated since it calls pygettext (as staded above)...
> 
> I've read the info pages of gettext too (quite a long work).
Ok, you should use xgettext to create a .po file from your test1.py.
Translate that file and use msgfmt to compile it into a .mo file.
Copy this .mo file to /usr/share/locale/fr/LC_MESSAGES/
 
> Here's my test1.py file again :
> 
> ===========================
> import gettext, os, locale
> 
> locale.setlocale(locale.LC_ALL)
> gettext.install('test1.py', '/usr/share/locale')
test1.py is wrong, you must give the name of the .mo file.
It must be:  gettext.install('test1.mo', '/usr/share/locale')
Assuming you have called the mo file like that.

Stas Z





More information about the Python-list mailing list