[sugar] internationalization problem

Erik Blankinship erikb
Fri Jan 4 16:45:20 EST 2008


Trying to run Record in Spanish is causing a problem.  I will outline the
steps which create this problem.  Hopefully someone can clarify where the
bug is.

In Constants.py, we define the following string:

#TRANS: photo by photographer, e.g., "Photo by Mary"
istrBy = _("%(1)s by %(2)s")

Which was picked up when we ran python genpot to create Record.pot.

A translator kindly translated Record.pot into Spanish to create es.po:

#. TRANS: photo by photographer, e.g., "Photo by Mary"
#: constants.py:99
#, python-format
msgid "%(1)s by %(2)s"
msgstr "%(1)s por %(2)s"

Then, we created Record-49.xo by running python setup.py dev and python
setup.py dist in the sugar shell.  This creates and populates the locale
directory with lots of files.

Then we install the program on an xo and run it.

Then we take a picture, and that process tries to assign metadata to a
datastory entry, but crashes with this stack trace:

--> 371         recd.title = Constants.istrBy % {"1":stringType, "2":str(
recd.recorderName)}
        recd.title = None
        global Constants.istrBy = '%(1) por %(2)'
        stringType = 'Foto'
        global str = undefined
        recd.recorderName = u'dude face'
...
<type 'exceptions.ValueError'>: unsupported format character 'p' (0x70) at
index 5

What is strange is the line Constants.istrBy = '%(1) por %(2)'

This string appears to have lost its "s" at the end of the (1) and the (2)
(which we can see were included in the es.po file above).  I am not sure how
this would have happened, but it does seem to make some sense of the error
(the p character being the first thing interpreted after where an s was
expected.

Any ideas on where we're doing something wrong?  Thanks.

Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/sugar/attachments/20080104/b487bce0/attachment.htm 



More information about the Sugar-devel mailing list