OK, thanks Rodrigo for the link to Babel. I had already seen it, but
never used it.
The problem I see with using Babel is that it IS an external library,
which means that I need to integrate it with my project. What I'm
looking for is a way to have a translated application WITHOUT having
to install any external library...

I am looking at 
http://makeyjl.blogspot.com/2009/02/using-djangos-i18n-in-google-app-engine.html
right now, and (while I'm not done playing around) I have already been
able to generate .po files, and my application still works OK. I'm
going to continue playing around, and then I'll report here about how
it went. If everything works fine I might even write a Knol article to
explain my steps (the article is not 100% accurate, I had to find out
to add "{% load i18n %}" in the templates for instance...

If anyone has another way of translating App Engine applications using
only the available tools, fell free to share it!

On 31 juil, 18:17, Rodrigo Moraes <rodrigo.mor...@gmail.com> wrote:
> Now, anwering some other questions.
>
> > - I suppose that the .po / .mo files that open source projects
> > traditionally use can not be used in the App Engine world?
>
> Yes, you can use those files with gettext functions. You'll probably
> need to wrap those functions and write some utilities to make it
> easier to use - but you don't need to do that because there are
> excellent libraries that have done it - Babel is the most known in the
> python world (I actually don't know any other).
>
> > - Would you have various template files for each languages (like a
> > contact.en.html, contact.fr.html, contact.nl.html, etc.) and use the
> > appropriate file depending on the language that has been detected from
> > the browser header?
>
> No! You would use one template, and have the strings wrapped by a
> translation function. The convention is to use a function name "_".
> Like:
>
> {{ _("This is my string - I'll translate it later, and if not it'll be
> in English forever.") }}
>
> There are issues you'll find, like how to handle singular/plural and
> string replacements, but existing solutions cover that.
>
> > - Would you use a single template file, but pass it the strings one by
> > one that you would retrieve from the datastore (ouch, just writing
> > this solution hurts!)
>
> Absolutelly no. The strings are stored in a .po file, which you
> compile into a .mo file. This if you go for the widely used gettext.
>
> > Note: if you execute the following command from inside the GAE dev
> > server folder:
> > find | xargs -i grep -iH i18n \{\}
> > you will see that a lot of files contain the string i18n, and that all
> > are related to django. Does that mean that we could use standard
> > Django internationalization techniques, or is it just that Google <
> > forgot > to remove those files?
>
> I tried to use Django's i18n. Unfortunately Django is too tied to
> itself and that library is not reusable outside of Django. Fortunately
> later I found a standalone, reusable, well written one: Babel. It
> works very well.
>
> -- rodrigo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to