nuxeo-localizer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nuxeo-localizer] How to create .po files


From: Juan David Ibáñez Palomar
Subject: Re: [Nuxeo-localizer] How to create .po files
Date: Tue, 26 Feb 2002 18:53:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020214

Gitte Wange wrote:

Hello,

I new to Localizer (but familiar with gettext tough) ... I have created a product where I want to translate some daynames in the class before returned to the UI.

I have looked at the NuxWidgets product and seen how you created the Multilingual class ... so now I now how the text actual gets translated ..

Yesterday I released Localizer 0.8.1 (still unnounced in Zope.org), and the way that is currently used in NuxWidgets and that you've copied is deprecated. It still works
and will work for a long while, however.


But I'm still wondering how to create the .po files ... I have tried using the zgettext.py script parsing it my .py file ... but the da.po file it creates have no message strings ..
What am I doing wrong ?


The problem, I guess, is that you are translating a variable, like in NuxWidgets. The parsers (zgettext or pygettext or xpot or xgettext or ..) only can detect literal
strings, that is:

 gettext(name)                # doesn't works, because name is a variable
 gettext('hello world')    # works because 'hello world' is a literal

The solution I take in NuxWidgets is to add by hand the weekdays to the "locale.pot" file. Then, when zgettext.py is used it preserves the messages from locale.pot and
copies them to the PO files.

However, this is not the thing you should do. What you should do is:

0. Download and install Localizer 0.8.1 (from "http://sf.net/projects/lleu";)

 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.


This is a well known problem, they're "Deferred translations", if you've
some minutes read the relevant section of the Python documentation:

 http://www.python.org/doc/2.1.2/lib/node196.html

This documentation proposes two solutions, you can actually use the one
that you prefer. I prefer the second one.

Next version of NuxWidgets will do it this way.


TIA,
Gitte Wange

_______________________________________________
Nuxeo-localizer mailing list
address@hidden
http://mail.freesoftware.fsf.org/mailman/listinfo/nuxeo-localizer



--
J. David Ibáñez, Nuxeo.com
Libre Software zealot (http://www.fsf.org)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]