Internationalization with gettext
"Alec Matusis" <[email protected]> Wed, 19 Jan 2011 14:57:16 -0800
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <0e7101cbb82c$385de320$a919a960$@com> |
We're trying to translate our templates using Python's gettext module.
>From reading
http://www.cheetahtemplate.org/docs/users_guide_html_multipage/tips.gettext.
html
it appears that I need to mark text for translation like this:
$_("This text will be translated")
or like this
$ngettext("This text will be translated")
The templates with marked text compile. Running xgettext (or pygettext.py )
on the compiled template successfully creates the .pot files, but the files
does not contain the marked strings.
Also, running the template produces the following error:
File
"/usr/local/lib/python2.4/site-packages/Cheetah-2.4.4-py2.4-linux-i686.egg/C
heetah/NameMapper.py", line 246, in valueFromSearchList
_raiseNotFoundException(key, searchList)
File
"/usr/local/lib/python2.4/site-packages/Cheetah-2.4.4-py2.4-linux-i686.egg/C
heetah/NameMapper.py", line 167, in _raiseNotFoundException
raise NotFound(excString)
NotFound: cannot find '_'
which means it cannot find _() function.
Can anybody show me how to mark text for translation?
I am using Cheetah 2.4.4 for these tests. We have Cheetah 0.9.15 in
production, but I believe that 0.9.15 does not have gettext functionality at
all- is that correct?
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl