On Aug 29, 2011, at 9:26 PM, Jonathan Lundell wrote: > On Aug 29, 2011, at 8:50 PM, Massimo Di Pierro wrote: > >> The parametric router allows: >> >> routers = dict( >> # base router >> BASE = dict( >> default_application = app, >> ), >> app = dict( >> default_language = 'en', >> languages = ['en', 'it', 'pt', 'pt-br'], >> ), >> ) >> >> and than in the model you do: >> >> T.force(request.lang) >> >> Not clear whether anybody has ever tested this. > > Only unit tests. But the logic is pretty straightforward.
There's one more step required: based on whatever user input you want to use to select the language in the first place, you need to set request.lang before calling URL, at least the first time. > >> >> Massimo >> >> >> On Aug 29, 2:26 pm, Alexander Cabezas <[email protected]> wrote: >>> I want to change the application language through URL function, but >>> this doesn't expect the "lang" parameter. >>> >>> I did some tests with these >>> adresseshttp://127.0.0.1:8000/es-es/default/index >>> andhttp://127.0.0.1:8000/fr-fr/default/indexand it changed the >>> application language due to "gluon.rewrite". >>> >>> But I want to do this with URL function in order to put in the website >>> a Language Selector (SELECT and A tag). >>> >>> Massimo or somebody else, any clue? >

