[sugar] internationalization problem

Walter Bender walter at laptop.org
Fri Jan 4 17:40:35 EST 2008


the problem is that your asking the translator to not just translate
strings, but also your python code. that won't work.

-walter

On Jan 4, 2008 4:45 PM, Erik Blankinship <erikb at mediamods.com> wrote:
> 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
> _______________________________________________
> Sugar mailing list
> Sugar at lists.laptop.org
> http://lists.laptop.org/listinfo/sugar
>
>



-- 
Walter Bender
One Laptop per Child
http://laptop.org


More information about the Sugar mailing list