Ajout version anglaise de cmf_defaut
[Plinn.git] / userlanguages.py
1 # -*- coding: utf-8 -*-
2 from zope.publisher.browser import BrowserLanguages
3 from Products.CMFCore.utils import getUtilityByInterfaceName
4
5 class AuthenticatedUserLanguages(BrowserLanguages):
6
7 def getPreferredLanguages(self) :
8 mtool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
9 if mtool.isAnonymousUser() :
10 return super(AuthenticatedUserLanguages, self).getPreferredLanguages()
11 else :
12 m = mtool.getAuthenticatedMember()
13 userLangs = m.getProperty('preferred_languages', [])
14 return userLangs or super(AuthenticatedUserLanguages, self).getPreferredLanguages()