views:

405

answers:

2

Has anyone any suggestions on how to use internationalization in app engine / webapp / python. I have seen some posts re - django - translation support but i cant seem to find enough info on how to make it work.

What i need is a solution where

  1. browser can detect language
  2. user can override and set
  3. strings in templates and from code can be localized
  4. easy file editing for language support.

I'm new to app engine so need some easy to follow/understand pointers/code assistance

many than

A: 

Here I provide some informations about Internationalization and Localization under the Google App Engine framework. http://eflorent.blogspot.com/2010/08/internationalization-under-google-app.html

Emmanuel Florent
A: 

There are several options to consider.

  • Standard gettext(). See this code example. The code is outdated: there is a standard way to manage cookies and sessions, so it should be rewritten for the real usage.

Sometimes this method fails, see this issue. Usually it's resolved by just reuploading an application, but this is weird.

  • Use babel. It's pure python, so it can be integrated easily. The drawback is an external dependency, but it's small and good working. Here is an answer with explanations.

  • Don't do l10n and i18n in the code. My vision is that GAE should be a backend service, serving html just occasionally.

Recently I did the project requiring web UI in several languages. This time I've generated a set of templates in all languages needed by making a 'master' template using _() and gettext() (python module, not django tags), extracting strings and iterating over the languages. A simple template loader checks the current language and loads an appropriate template. The idea is shamelessly stolen from p. 1.

eGlyph