1 # -*- coding: utf-8 -*-
2 from zope
.publisher
.browser
import BrowserLanguages
3 from Products
.CMFCore
.utils
import getUtilityByInterfaceName
5 class AuthenticatedUserLanguages(BrowserLanguages
):
7 def getPreferredLanguages(self
) :
8 mtool
= getUtilityByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
9 if mtool
.isAnonymousUser() :
10 return super(AuthenticatedUserLanguages
, self
).getPreferredLanguages()
12 m
= mtool
.getAuthenticatedMember()
13 userLangs
= m
.getProperty('preferred_languages', [])[:]
14 return userLangs
or super(AuthenticatedUserLanguages
, self
).getPreferredLanguages()