Stephan Richter wrote:

>> - How do a write/register a negotiator that choose a language based on
>> an attribute of the user object and then falls back to normal browser
>> negotiation if that attribute isn't present?
> Just implement the right interface and register it. This is not too hard and 
> I 
> think there are code examples out there.

There is an example on Philipp's book.

I don't have it here, but this for instance FORCES italian all the way:

from zope.publisher.browser import BrowserLanguages

class BrowserItalianLanguage(BrowserLanguages):

    def getPreferredLanguages(self):
#        langs = super(BrowserFormLanguages, self).getPreferredLanguages()
        return ['it']

and then in overrides.zcml:


of course you would normally get 'langs' from the super method and
manipulate it before returning

Zope3-users mailing list

Reply via email to