On Oct 23, 12:12 pm, Anand Chitipothu <[email protected]> wrote:
> I generally do it something like this:
>
> def i18n_loadhook():
>     web.ctx.lang = web.input(lang=None, _method="GET").lang
>
> app.app_processor(web.loadhook(i18n_loadhook))
>
> def custom_gettext(string):
>     """Translate a given string to the language of the application."""
>     translation = web.ctx.lang and load_translations(web.ctx.lang)
>     if translation is None:
>         return unicode(string)
>     return translation.ugettext(string)

Already append your method as reference in cookbook. :)
http://webpy.org/cookbook/runtime-language-switch
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to