Пример #1
0
    def setLanguage(self):
        """Set the given language in the request to the session.
        
        You can do it via the javascript sessionlanguage.js with the
        javascript method setLanguage:
        
        javascript:setLanguage('@@setLanguage','de')
        
        Or send the request to the view '@@setLanguage'. There has to be a 
        variable 'language' and 'nextURL' in the request like
        """
        nextURL = '.'

        if "language" in self.request:
            lang = self.request['language']
        
        if "nextURL" in self.request:
            nextURL = self.request['nextURL']

        if lang:
            session = ILanguageSession(self.request)
            session.setLanguage(lang)

        self.request.response.redirect(nextURL)