I'm trying to wrap my head around the docs at python.org related to the gettext-module, but I'm having some problem getting it to work. Is there any really simple, step-by-step on how to use this module available?
This is my script so far : import gettext gettext.install('test2', '.', unicode=1) lang1 = gettext.translation('test2', languages=['no']) print _('writing a log to file') in the folder where the test2.py-script lives I've created a folder-structure like ./locales/NO/LC_MESSAGES/messages.mo the messages.mo-file I've created using the scripts in the \Tools\i18l\-folder by running : python pygettext.py test2.py and renaming the generated messages.pot-file to messages.po, and editing it to look like : # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR ORGANIZATION # FIRST AUTHOR <[EMAIL PROTECTED]>, YEAR. # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2005-11-22 13:02+W. Europe Standard Time\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n" "Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" "Generated-By: pygettext.py 1.5\n" #: test2.py:5 msgid "writing a log to file" msgstr "skriver logg til fil" and then run python msgfmt.py messages.po and moving it to ./locales/NO/LC_MESSAGES/messages.mo When I run python test2.py it gives me this error : Traceback (most recent call last): File "C:\Program Files\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 307, in RunScript debugger.run(codeObject, __main__.__dict__, start_stepping=0) File "C:\Program Files\Python24\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run _GetCurrentDebugger().run(cmd, globals,locals, start_stepping) File "C:\Program Files\Python24\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 631, in run exec cmd in globals, locals File "C:\Program Files\Python24\Tools\i18n\test2.py", line 4, in ? lang1 = gettext.translation('test2', languages=['no']) File "C:\Program Files\Python24\lib\gettext.py", line 456, in translation raise IOError(ENOENT, 'No translation file found for domain', domain) IOError: [Errno 2] No translation file found for domain: 'test2' Hmmm ... any hints? Thomas -- http://mail.python.org/mailman/listinfo/python-list