|
From: | Juan David Ibáñez Palomar |
Subject: | Re: [Nuxeo-localizer] How to create .po files |
Date: | Tue, 26 Feb 2002 19:16:41 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020214 |
1. Remove the "Multilingual" stuff 2. At the beginning of the module, type: from Products.Localizer import Gettext _ = Gettext.translation(globals()) N_ = Gettext.dummy 3. Translate your messages with "_(message)" 4. Somewhere in the module, type: N_('Monday') N_('Tuesday') ... 5. Run zgettext.py, it will work because 'Monday', etc.. are literals and because it recognizes the N_ function.Hmm ... but I want to translate some variables ... can't I do that ?(I get the variables from e.g. DateTime.Month() )
Yes, you can do it. The function "_" will translate the string returned by "DateTime.Month()", if the translation is available. The function "N_" just returns the same string. It's used to mark up strings to translate, so the extraction tool (zgettext.py) can detect and add them to the PO files. You just need to know which are all the values that the "Month" method can return and add a line for each one: N_('January') N_('February') ... Cheers, -- J. David Ibáñez, Nuxeo.com Libre Software zealot (http://www.fsf.org)
[Prev in Thread] | Current Thread | [Next in Thread] |