[gettext] Ne fonctionne pas
Bonjour,
J'ai le script suivant :
Code:
1 2 3 4 5 6 7 8 9
| #!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import locale
print locale.getdefaultlocale()
import gettext
gettext.install('test', '/home/jerome/Programming/python/', unicode=1)
print _('Hello world') |
J'ai le fichier i18test.po suivant (ainsi que le fichier .mo correspondant) sous fr_FR/:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| msgid ""
msgstr ""
"Project-Id-Version: Test\n"
"POT-Creation-Date: 2011-08-09 22:12+CEST\n"
"PO-Revision-Date: 2011-08-09 22:13+0100\n"
"Last-Translator: Jérôme Brilland\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"X-Poedit-Language: French\n"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-SourceCharset: iso-8859-5\n"
#: i18test.py:9
msgid "Hello world"
msgstr "Bonjour le monde" |
Or l'exécution du script affiche toujours "Hello world". Que faut-il faire pour faire fonctionner gettext ?