Changeset 7678 for main/waeup.sirp/trunk/src/waeup/sirp/language.py
- Timestamp:
- 22 Feb 2012, 11:37:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/language.py
r7676 r7678 18 18 19 19 import grokcore.component 20 from zope.component import getUtility 20 21 from zope.publisher.interfaces.browser import IBrowserRequest 21 22 from zope.i18n.interfaces import IUserPreferredLanguages 22 23 from waeup.sirp.configuration import ConfigurationContainer 24 from waeup.sirp.interfaces import ISIRPUtils 23 25 24 26 class SIRPLanguage(grokcore.component.Adapter): 25 """Set p ortal and preferred languages"""27 """Set preferred languages""" 26 28 grokcore.component.context(IBrowserRequest) 27 29 grokcore.component.implements(IUserPreferredLanguages) 28 # This the only place where we define the portal language29 # which is used for the translation of system messages30 # (e.g. object histories).31 portal_language = 'en'32 30 33 31 def getPreferredLanguages(self): 32 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 33 34 34 # This an adapter for the request, so self.context is the request. 35 35 request = self.context 36 36 37 37 # Extract the preferred language from a cookie: 38 lang = request.cookies.get('sirp.language', self.portal_language)38 lang = request.cookies.get('sirp.language', portal_language) 39 39 40 40 # According to IUserPreferredLanguages, we must return a list.
Note: See TracChangeset for help on using the changeset viewer.