Changeset 7676
- Timestamp:
- 22 Feb 2012, 10:33:27 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7674 r7676 198 198 199 199 def update(self, lang='en', view_name='@@index'): 200 self.response.setCookie(' waeup.sirp.language', lang, path='/')200 self.response.setCookie('sirp.language', lang, path='/') 201 201 self.redirect(self.url(self.context, view_name)) 202 202 return -
main/waeup.sirp/trunk/src/waeup/sirp/language.py
r7675 r7676 20 20 from zope.publisher.interfaces.browser import IBrowserRequest 21 21 from zope.i18n.interfaces import IUserPreferredLanguages 22 from waeup.sirp.configuration import ConfigurationContainer 22 23 23 24 class SIRPLanguage(grokcore.component.Adapter): 24 """ Extract the preferred language"""25 """Set portal and preferred languages""" 25 26 grokcore.component.context(IBrowserRequest) 26 27 grokcore.component.implements(IUserPreferredLanguages) 27 28 # No need to implement __init__, it's already provided by the base class. 28 # This the only place where we define the portal language 29 # which is used for the translation of system messages 30 # (e.g. object histories). 31 portal_language = 'en' 29 32 30 33 def getPreferredLanguages(self): … … 33 36 34 37 # Extract the preferred language from a cookie: 35 lang = request.cookies.get(' waeup.sirp.language', 'en')38 lang = request.cookies.get('sirp.language', self.portal_language) 36 39 37 40 # According to IUserPreferredLanguages, we must return a list.
Note: See TracChangeset for help on using the changeset viewer.