According to router.example.py, it should be request.language, not
request.lang, though the only reference I see in rewrite.py is
request.uri_language, so maybe try both of those and see if it works.
Anthony
On Tuesday, May 1, 2012 5:27:07 PM UTC-4, ender72 wrote:
>
> Hi,
> I'm reading "web2py application development cookbook",
> page 277
> "To specify a language for outgoing URLs using URL(), set request.lang to
> one of the supported languages [...]".
>
> Mmm... maybe something's wrong, because if I put this code in a view:
>
> {{
> request.lang='it'
> link_it = URL('about', 'index')
> request.lang='en'
> link_en = URL('about', 'index')
> request.lang='fr'
> link_fr = URL('about', 'index')
> }}
> {{=link_it}}, {{=link_en}}, {{=link_fr}}
>
> results are:
> /en/azienda, /en/azienda, /en/azienda
> (if request.url is http://127.0.0.1:8000/app/en/<controller>/<function>/)
> or
> /it/azienda, /it/azienda, /it/azienda
> (if request.url is http://127.0.0.1:8000/app/it/<controller>/<function>/)
> etc...
>
> my routes.py is
>
> routers = dict(
> BASE = dict(
> default_application='app',
> default_controller = 'home',
> default_function = 'index'
> ),
> casal = dict(
> map_hyphen = True,
> languages = ['it', 'en', 'fr'],
> default_language = 'it',
> ),
> )
>
>
> Thanks.
>