I have translated my service running on GAE in various language. The code below works.
However, I want to be able to specify also the country. Specifically, I want to be able to use 2 Portuguese translations: pt_PR and pt_BR. (I have already created the 2 folder with the .mo files)
i18n.get_i18n().set_locale(language)
localedir = '/'.join((os.path.dirname(__file__), '..', 'locale'))
try:
transl = gettext.translation('strings', localedir = localedir, languages = [language])
except IOError:
return
transl.install()
I'm using webapp2 as framework.
It seems that you can pass languages = ["pt_PT"] or ["pt"] for the Portugues translation, ["pt_BR"] for the Brazilian one.