Back to index

plone3  3.1.7
switchLanguage.py
Go to the documentation of this file.
00001 ## Script (Python) "switchLanguage"
00002 ##title=
00003 ##bind container=container
00004 ##bind context=context
00005 ##bind namespace=
00006 ##bind script=script
00007 ##bind subpath=traverse_subpath
00008 ##parameters=set_language=None
00009 REQUEST=context.REQUEST
00010 
00011 if set_language:
00012     lang=set_language
00013 
00014 here_url=context.absolute_url()
00015 
00016 query = {}
00017 if lang:
00018     # no cookie support
00019     query['cl']=lang
00020 
00021 if set_language:
00022     query['set_language']=lang
00023 
00024 qst="?"
00025 for k, v in query.items():
00026     qst=qst+"%s=%s&" % (k, v)
00027 redirect=here_url+qst[:-1]
00028 
00029 REQUEST.RESPONSE.redirect(redirect)
00030