International APPs / pygettext
Ingo Linkweiler
i.linkweiler at web.de
Wed Oct 16 07:55:44 EDT 2002
Now I have got all required tools, and started with this program:
import gettext
gettext.install('langtest')
print _("Hello World")
Then I typed:
> pygettext.py langtest.py
and got this file "messages.pot", I added the translation to msgstr.
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: Wed Oct 16 13:34:06 2002\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: pygettext.py 1.4\n"
#: langtest.py:6
msgid "Hello World"
msgstr "Hallo Welt"
I renamed this file to "messages.de.po" and run the GNU msgfmt (a
complied windows version was was included in the CygWin package):
> msgfmt messages.de
msgfmt: messages.de.po: warning: Charset "CHARSET" is not a portable
encoding name. Message conversion to user's charset might not work.
I ignored this warning and got a file "messages.mo"
Now I run the python source. Result :-(
Hello World
Next try: Changed source to
import gettext
#gettext.install('langtest')
lang = gettext.translation(languages=['de'])
lang.install()
print _("Hello World")
Result:
Traceback (most recent call last):
File "D:\EIGENE~1\source\PyNassi\langtest.py", line 3, in ?
lang = gettext.translation(languages=['de'])
TypeError: translation() takes at least 1 non-keyword argument (0 given)
Can you help me?
More information about the Python-list
mailing list