On Aug 31, 10:44 pm, Alexander Cabezas <[email protected]> wrote:
> Did you build it with web2py?

No, that website is powered by PHP.

> How could I do the same thing in my application?

As Massimo mentioned here (https://groups.google.com/d/msg/web2py/
q2B9mekNCwk/tUmqU0Iu-ZIJ), with the exception that in the model
(db.py) you put, instead of
> T.force(request.lang)
this (from here (https://groups.google.com/d/msg/web2py/fpFJQlI21w4/
M1BWlGkB6v8J))
> if request.uri_language: T.force(request.uri_language)

it works well with welcome application.

this is severely underdocumented in the book! i18n section (http://
www.web2py.com/book/default/chapter/04#T-and-Internationalization)
needs extending.


but now that I read your post again, and as I understand, I don't
think you can do it.
you can't link from http://site.com/en/content to http://site.com/fr/content
with URL().
in order to be able to do so, URL needs a lang parameter, so one can
do:
<a href="{{=URL(a='app', lang='fr', c='controller',
f='function', ...)}}">French</a>
lang must come in between application and controller.

EDIT: disregard half. you can hack it.
URL() by default produces absolute scheme-less URLs, like this /a/c/f.
so to link from http://site.com/en/a/c/f to http://site.com/fr/a/c/f,
you prepend URL() call with '/fr', like this:
<a href="/fr{{=URL(a=request.application, c=request.controller,
f=request.function, ...)}}">French</a>

HTH?

Reply via email to