[Grok-dev] How to overrule browser language default by English?

Christian Klinger cklinger at novareto.de
Thu Oct 29 10:05:48 EDT 2009

Hi Kris,

look at this example, is out of my head but it should work:
So maybe there are some typos ;).

import grok
from zope.publisher.interfaces.browser import IBrowserRequest
from zope.i18n.interfaces import IUserPreferredLanguages

class CookieLanguage(grok.Adapter):
     """Extract the preferred language from a cookie"""

     def getPreferredLanguages(self):
         return ['en']

This should return always 'en' as your language.
If you want more information please look at the IUserPreferredLanguages 


> Dear,
> We want to use English as our default language for displaying our pages
> in grok. No other languages are supported.
> Now, we have the problem that the button names are in English but the
> error messages are in Dutch because the browser language is Dutch.
> Can we somehow overrule the language of the browser?
> Regards,
> Kris Degryse
> R&D Engineer
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev

More information about the Grok-dev mailing list