And if you add at the end of the db.py file:
if request.uri_language: T.force(request.uri_language)

it will set the good language.

Il giorno venerdì 20 marzo 2015 20:04:24 UTC+1, Gael Princivalle ha scritto:
>
> Salut Olivier.
>
> I use that router and for me it works fine:
> routers = dict(
> BASE = dict(
>         domains = {
>     "www.mydomain.com" : "my_app", 
> }
> ),
> my_app = dict(languages=['en', 'fr'], default_language='fr'),
> )
>
> The original website (words in the .html files) have to be in english.
>
> After you must edit fr language file for applying translations.
> For example:
> T('A beautiful journey')
> Load one time the .html page.
> Search for 'A beautiful journey' in the fr language file.
> Translate and save.
>
> For bigger contents make double fields in tables:
> product_description_en
> product_description_fr
>
> And in the .html file test which is the request.uri_language for 
> displaying one or the other field.
>
> Hopes it could help, bye. 
>
> Il giorno mercoledì 18 marzo 2015 17:50:22 UTC+1, olivier hubert ha 
> scritto:
>>
>> I try to made a simple multi language site with routes, but I can't.
>> The routing are correct because I can use the url like this 
>> http://127.0.0.1:8000/*testme*/en/ and *translate* application are serve.
>> But translate application is always in french!
>>
>> translate application is a copy of welcome application with the 
>> modifications below.
>>
>> Web2Py version : 2.9.12-stable+timestamp.2015.01.17.06.11.03 (Running on 
>> Rocket 1.2.6, Python 2.7.8)
>>
>> /web2py/routes.py
>> ------------------------------
>>
>> routes_in = (
>>   
>> ('/testme/$language/(?P<any>.*)','/translate/default/$any?_language=$language'),
>>  
>> )
>>
>> /translate/models/0.py
>> -----------------------------
>>
>> print request.vars
>> if request.vars._language: 
>>     T.force(request.vars._language)
>>
>> Terminal window return:
>> ------------------
>> <Storage {}>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to