gettext again

cantabile cantabile.03 at wanadoo.fr
Sun Aug 7 20:56:35 EDT 2005


stasz a écrit :
> 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
> 
> 

Well, I did this exactly... and still no go.

Is this sequence correct :
1° xgettext test1.py
2° mv messages.po messages.pot
3° msginit
4° Translate msgstr"" in fr_FR at euro.po file
5° msgfmt -o test1.mo fr_FR at euro.po
6° cp test1.mo /usr/share/locale/LC_MESSAGES
7° python test1.py


This is what I did, without success. Must be bewitched :((



More information about the Python-list mailing list