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-additions http://docs.turbogears.org/1.1/Internationalization#localization-of-javascript http://docs.turbogears.org/1.0/WidgetsWithJSAndCSS 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 -~----------~----~----~----~------~----~------~--~---

