Changeset 7832
- Timestamp:
- 10 Mar 2012, 04:29:35 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/language.py
r7819 r7832 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 18 """Handle language as requested by users. 19 """ 19 20 import grokcore.component 20 21 from zope.component import getUtility 21 22 from zope.publisher.interfaces.browser import IBrowserRequest 23 from zope.session.interfaces import ISession 22 24 from zope.i18n.interfaces import IUserPreferredLanguages 23 25 from waeup.kofa.configuration import ConfigurationContainer … … 30 32 31 33 def getPreferredLanguages(self): 32 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE33 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('kofa.language', portal_language) 38 lang = request.cookies.get('kofa.language', None) 39 if lang is None: 40 lang = getUtility(IKofaUtils).PORTAL_LANGUAGE 41 request.response.setCookie('kofa.language', lang, path='/') 39 42 40 43 # According to IUserPreferredLanguages, we must return a list.
Note: See TracChangeset for help on using the changeset viewer.