nuxeo-localizer
[Top][All Lists]
Advanced

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

Re: [Nuxeo-localizer] Re: zwiki i18n progress, questions


From: Juan David Ibáñez Palomar
Subject: Re: [Nuxeo-localizer] Re: zwiki i18n progress, questions
Date: Sat, 01 Jun 2002 11:54:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020520 Debian/1.0rc2-3

Simon Michael wrote:

Juan David Ibáñez Palomar <address@hidden> writes:
eehh..  not sure to understand, _() should be sensitive to web
browser settings, actually language negotiation is orthogonal
to the rest of the system, so you don't have to do anything
with it.

Ok, that sounds cool. So my plan is to generate big po files for all
strings in the product code and in the zwikidotorg template files, and at
runtime have both product code and zwikidotorg dtml code use them. I
think I'll need to expose _() as page.gettext() for the dtml.


For the DTML that lives in the filesystem you just have to
use LocalDTMLFile instead of DTMLFile, and then use directly:
<dtml-var "gettext('..')">, the following code should work:

try:
   from Products.Localizer import LocalDTMLFile as DTMLFile
except ImportError:
   from Globals import DTMLFile


Well, you still need to provide a dummy "gettext" function, so
it won't break if Localizer is not installed.


I'd like to setup a testing instance here to help you to solve
these problems. Please, checkin the ".po" files. Also, if you

done

want more help from me I would be happy to contribute (as my
time permits), my userid in SourceForge is "jdavid".

thanks, I have added you as a developer.



thanks,


- how best to mark large multiline strings ?
In DTML with <dtml-gettext>...</dtml-gettext>

In Python, I'm not sure, have you tried """...""". Perhaps
zgettext will need some work to support this.

It recognized """...""" but left some odd indentation in the .po file
which scared me off. It might not be a problem.


I'll look at it..


- should common html/dtml be separated out ?
Not sure to understand, an example??

Here's the current edit conflict dialog::

       return MessageDialog(
           title=titlestr,
           message="""
           <b>%s</b>
           <p>
           %s.
           %s:
           <ol>
           <li>%s
           <li>%s
           <li>%s
           <li>%s
           <li>%s.
           </ol>
           %s,
           <p>
           %s.
           """ % (
           titlestr,
           _("Someone else has saved this page while you were editing"),
           _("To resolve the conflict, do this"),
           _("Click your browser's back button"),
           _("Copy your recent edits to the clipboard"),
           _("Click your browser's refresh button"),
           _("Paste in your edits again, being mindful of the latest changes"),
           _("Click the Change button again"),
           _("or"),
           _("To discard your recent edit and start again, click OK"),
           ),

It would have been easier to treat it as one big string, but then the html
code appears in the po files and each translator has to take care to
preserve it. If this had complicated dtml making it hard just to read, it
would be worse. So I wondered if it's usual to do some work to separate
out just the strings needing translation.


I think this is a matter of taste, at least for this example
I'm not sure what I would do.

Whatever you do, usually is better to split to split the text
by sentences (as you've done).

However, strings as short as "or" could be difficult to translate,
maybe there're languages where the word "or" has multiple translations
depending on the context.

The best is to avoid the use of sentences so short, you can also
wait for a translator to complain.


- alternatives to zgettext.py ?
1. the standard gettext utilities, since 0.11.1 xgettext supports Python

2. pygettext, which is part of the Python since version 1.6 (I think)

3. xpot: http://www.iro.umontreal.ca/~pinard/po-utils/HTML/
  (there's a Debian package)

However, there're some reasons to use zgettext, for example it parses
the "dtml-gettext" tag, and it automates some steps of the i18n of a
Zope product that otherwise should be done manually.

what steps are those ? I guess I can look at the source.


Localizer stores the PO/MO files in a non standard directory
organization, and zgettext takes care of it.

All PO/MO files are stored in the "locale" subdirectory with
the names "<lang>.po". If you do it manually, for example with
Makefile, you just need to be sure that the files are stored
this way, or they won't be find at run time.



- why doesn't mozilla show the translation ? (ns does)

this one I saw with my own zwiki translation


I'll test it..


- why does mozilla give a blank page with localizer's select language menu ?
- why does ns give the unchanged page with localizer's select language menu ?

these I saw at http://nuxeo.org/localizer. Netscape works now (I think
enabling cookies did it); I still see the problem with mozilla 1.0rc2.


Yes, the language selection box uses cookies, it should work
anyway changing the language configuration of the browser.



Another issue, I've seen in the ZWiki's source strings like:

 _("This page was renamed to")+" %s.\n" % (newid)

This is not correct, because the position of "newid" could
change in other languages, the right string would be:

 _("This page was renamed to %s\n") % newid

If there's more than one parameter you've to use formatted
strings by name: "%(newid)s"

Aha, thanks for the tip. I am brand new to this stuff. All I can say is,
thank god for those who blazed this trail so the rest of us don't have to. :)


:-) Many people has been dealing with these issues for a long
time.

However, most developers ignore i18n, until their software
becomes successful enough to rise the interest of people
around the world, and its new users start to complain..,
then, there's no way back :-)


--
J. David Ibáñez, Nuxeo.com
Python programmer (http://www.python.org)





reply via email to

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