Changeset 7676


Ignore:
Timestamp:
22 Feb 2012, 10:33:27 (13 years ago)
Author:
Henrik Bettermann
Message:

Define portal language in SIRPLanguage adapter, not yet needed, but we will in the future.

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  
    198198
    199199    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='/')
    201201        self.redirect(self.url(self.context, view_name))
    202202        return
  • main/waeup.sirp/trunk/src/waeup/sirp/language.py

    r7675 r7676  
    2020from zope.publisher.interfaces.browser import IBrowserRequest
    2121from zope.i18n.interfaces import IUserPreferredLanguages
     22from waeup.sirp.configuration import ConfigurationContainer
    2223
    2324class SIRPLanguage(grokcore.component.Adapter):
    24     """Extract the preferred language"""
     25    """Set portal and preferred languages"""
    2526    grokcore.component.context(IBrowserRequest)
    2627    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'
    2932
    3033    def getPreferredLanguages(self):
     
    3336
    3437        # 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)
    3639
    3740        # According to IUserPreferredLanguages, we must return a list.
Note: See TracChangeset for help on using the changeset viewer.