7

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

spidee
  • 557
  • 1
  • 6
  • 21
  • You are probably confusing localization with internationalization, which makes your search a bit harder (you want to look for internationalization). Please read article for an explanation of the difference: http://www.w3.org/International/questions/qa-i18n – Tom van Enckevort Feb 10 '10 at 11:20
  • Ah - doh! sorry i do know what i mean - long nite of programming has left brain dead - i will repost this. Many thanks for making look stupid. I will post a link to the new post should anyone else be interested. – spidee Feb 10 '10 at 17:23
  • You should have just edited this question, not created a new one. – Tom van Enckevort Feb 11 '10 at 11:57

2 Answers2

2

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.

Community
  • 1
  • 1
eGlyph
  • 1,117
  • 6
  • 11
1

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