Reading further I found out that there is NO single language decided
to render a page. The string lookups happen independently for each
translated string starting with the main language and going through
the fallback languages.

This basically means, I need to write my own function to decide which
js file to send depending on the order of accepted languages sent by
the browser and hope that I have all translated strings so the
independent lookups do not result in different languages mashed
together on the same page!

On Oct 13, 6:43 pm, gizli <[email protected]> wrote:
> Ok. By referring tohttp://docs.turbogears.org/2.0/RoughDocs/1.1Migration,
> I was able to adapt the code you just provided to TG2. But the
> function that I found in tg.i18n (get_lang) still does not give me the
> "chosen" language for the page to render. It gives all of the accepted
> languages sent by the browser in an array (i.e. same thing as
> tg.locale).
>
> On Oct 13, 5:31 pm, Christopher Arndt <[email protected]> wrote:
>
>
>
> > gizli schrieb:
>
> > > My specific question is
> > > what function should I call from within the template to get the actual
> > > locale of the request?
>
> > > My generic question is: Is there a better way of doing this? In the
> > > end, I want to have this javascript file included in my template:
>
> > TurboGears by default determines the locale to use for a specific
> > request with the 'turbogears.i18.utils._get_locale' function.
>
> > I just updated the configuration reference to include the relevant
> > configuration settings for i18n:
>
> >http://docs.turbogears.org/1.1/Configuration#internationalization
>
> > You can use the 'i18n.get_locale' config setting to specify our own
> > custom function to determine the locale but usually the default function
> > should be fine.
>
> > You could inject this function into your template name space using the
> > 'view.variable_providers' mechanism. Or you create a custom widget which
> > creates a JSLink to the JS file with the translations appropriate for
> > your locale and include this in the 'tg.include_widgets' setting.
>
> >http://docs.turbogears.org/1.0/stdvars#custom-additionshttp://docs.tu...
>
> > Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to