Is it possible that nobody knows how this request.uri.language works ?
Il giorno venerdì 10 gennaio 2014 13:32:19 UTC+1, Gael Princivalle ha
scritto:
>
> 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.