[Grok-dev] How to force language settings in Grok, overriding browser settings
sebastian at urbantalk.se
Thu Jan 5 14:07:27 UTC 2012
I just want to add this piece of code since I have tried to figure this out for a couple of years... :D but solved it now and it might save someone some time...
In order to force the language settings (in my case the settings are in the page in a multilingual site), I use the following code:
from zope.i18n.interfaces import IModifiableUserPreferredLanguages
language = self.context.language # Language settings stored in context,
# iso-two letter style "sv", "en"
mupl = IModifiableUserPreferredLanguages(self.request)
Still dreaming about the Grok cookbook... :D
More information about the Grok-dev