I realize this is an old thread but I was experiencing similar problems with web2py and it's custom language behavior. The problem is with the next assignment. The parameter passed to the 'read_possible_languages' function is not the correct path for the language files.
possible_languages = read_possible_languages(abspath('applications', app)) I was able to fix this problem by changing the instruction above to : possible_languages = read_possible_languages(abspath('applications', app, 'languages')) Now I can correctly override the language in my url using : *http://127.0.0.1:8000/MyApp/nl/default/index* or *http://127.0.0.1:8000/MyApp/du/default/index* I hope this helps other people with the same issue; again sorry for necromancing this thread! On Friday, January 10, 2014 at 1:32:19 PM UTC+1, Gael Princivalle wrote: > > Hello all. > > I'm in trouble with language management. > Here is my routes.py at web2py root (standard): > routers = dict( > > # base router > BASE=dict( > default_application='welcome', > ), > ) > > Here is my routes.py in the test application (standard). > from fileutils import abspath > from languages import read_possible_languages > > possible_languages = read_possible_languages(abspath('applications', app)) > > routers = { > app: dict( > default_language = possible_languages['default'][0], > languages = [lang for lang in possible_languages > if lang != 'default'] > ) > } > > In the test application, I've add this code at the end of the model db.py > file: > if request.uri_language: T.force(request.uri_language) > > And in my test application I've create this mypage page: > In controller: > def mypage(): > request_uri_language = request.uri_language > return locals() > > In view: > {{extend 'layout.html'}} > <h1>Template default/mypage.html</h1> > {{=BEAUTIFY(response._vars)}} > > If I try with mydomain.com/test/mypage > request_uri_language = en > > If I try with mydomain.com/test/it/mypage I've got this error: > invalid function (default/it) > > Someone can help me ? > > Thanks. > > -- 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.