Changeset 7678 for main/waeup.sirp/trunk/src
- Timestamp:
- 22 Feb 2012, 11:37:37 (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/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. -
main/waeup.sirp/trunk/src/waeup/sirp/utils/utils.py
r7620 r7678 36 36 37 37 class SIRPUtils(grok.GlobalUtility): 38 """A collection of methods subject to customization.38 """A collection of parameters and methods subject to customization. 39 39 """ 40 40 grok.implements(ISIRPUtils) 41 # This the only place where we define the portal language 42 # which is used for the translation of system messages 43 # (e.g. object histories). 44 PORTAL_LANGUAGE = 'en' 41 45 42 46 def sendContactForm(self,from_name,from_addr,rcpt_name,rcpt_addr,
Note: See TracChangeset for help on using the changeset viewer.