Re: Internationalization with gettext
"Alec Matusis" <[email protected]> Wed, 19 Jan 2011 22:09:46 -0800
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <103d01cbb868$a3d117d0$eb734770$@com> |
That did not help.
Earlier, I also tried to define function _() like so:
#import gettext
#t =3D gettext.translation('mymodule', '/home/alec/gettexttest', ('en-US',))
#_ =3D t.gettext
This code works in a stand-alone .py file.
Cheetah however still does not find _() function, even with this code at the
top.
From: James Abbatiello [mailto:[email protected]] =
Sent: Wednesday, January 19, 2011 7:24 PM
To: [email protected]
Subject: Re: [Cheetahtemplate-discuss] Internationalization with gettext
I've never used gettext with Cheetah but perhaps including a line like:
#from gettext import gettext as _
at the top of your template might help?
-- =
James Abbatiello
On Wed, Jan 19, 2011 at 5:57 PM, Alec Matusis <[email protected]> wrote:
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:
=A0File
"/usr/local/lib/python2.4/site-packages/Cheetah-2.4.4-py2.4-linux-i686.egg/C
heetah/NameMapper.py", line 246, in valueFromSearchList
=A0 =A0_raiseNotFoundException(key, searchList)
=A0File
"/usr/local/lib/python2.4/site-packages/Cheetah-2.4.4-py2.4-linux-i686.egg/C
heetah/NameMapper.py", line 167, in _raiseNotFoundException
=A0 =A0raise 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
_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
---------------------------------------------------------------------------=
---
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