Thanks, routes_in fragment seems to be what I was looking for. Session variable for remembering last selected language - I like that, I am going to include that also.
I am not sure about handling language purely using sessions in general. It could be worthful if you have an app like webmail for example and you want to translate it. But in case of site with content in multiple languages I believe that right way is to have pages (content) in different languages to have different URLs. How can search engine handle different language version of page/article if language is handled using sessions(and browser language setting) only? Jiri On 18 Dub, 17:41, mdipierro <mdipie...@cs.depaul.edu> wrote: > Personally I do not user routes much and I like to do > > if request.vars.force_language: session.force_language > if session.force_language: T.force(force_language) > > and have button in the 'index' page that reload the index page in > various languages > > <a href="{{=URL(r=request,vars=dict(force_language='fr- > fr'))}}">French</a> > > Because of the session var, web2py will remember my preferred > language. > > Massimo > > On Apr 18, 10:35 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > routes_in = ( > > ('/yourapp/static/(?P<any>.*)','/yourapp/static/$any'), > > ('/yourapp/$language/(?P<any>.*)','/yourapp/default/$any?_language= > > $language'), > > ) > > > and in your model > > > if request.vars._language: T.force(request.vars._language) > > > Massimo > > > On Apr 18, 9:49 am, Iceberg <iceb...@21cn.com> wrote: > > > > By the way, I believe the T("...") handles short phrase better, but if > > > you need to deal with some long article such as company background > > > description, it will also be a good choice to manually organize your > > > file as: > > > yourapp/static/en/about.html > > > yourapp/static/de/about.html > > > ... > > > > On Apr18, 10:09pm, Jason Brower <encomp...@gmail.com> wrote: > > > > > It's my understanding the web2py takes care of all the multi language > > > > stuff automatically, no need to set it in the browser. > > > > Just set the language file and make sure to put a T("") Around ya > > > > strings. > > > > br- > > > > Jason Brower > > > > > On Sat, 2009-04-18 at 04:14 -0700, jiri wrote: > > > > > Hello, > > > > > > I am new to web2py and I am working on multi-language site using this > > > > > framework. What is the best way to structure URLs for such site? > > > > > Previously I used this scheme (see below) in Pylons framework, it was > > > > > mapped using routing module to "lang" parameter and then correct > > > > > language was set up just before selected controller function (by URL) > > > > > was called. What I need to do to use this scheme in web2py or what is > > > > > the recommended way to do this? > > > > > > /en/about/ > > > > > /en/products/ > > > > > ... > > > > > /de/about/ > > > > > /de/products/ > > > > > ... > > > > > /es/about/ > > > > > /es/products/ > > > > > ... > > > > > > Jiri --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---