Hello, I would like to revive this older thread (which also relates to this
one: https://groups.google.com/forum/#!topic/web2py/ff1syTIl12o).
I'm new to web2py, and so far have been finding my way around ok (thanks to
the excellent docs), but the particular problem of mapping controllers and
functions to multi-language urls has me stumped.
Here is what I would like to achieve:
1. URLs appear in language of user:
app/news/latest (list of latest news in Eng)
app/nouvelles/recentes (maps to news/latest translated in Fr)
2. URLs rewritten when user toggles between languages (on news/latest page
in Eng, click 'French' button, get redirected to nouvelles/recentes page)
3. URLs in views appear in the language currently defined in the session.
For example, if in layout.html, I have URL('news','latest'), it shows as
app/nouvelles/recentes when the session language is French.
Would there be an elegant solution for achieving this?
Thanks.
On Sunday, 13 November 2011 04:02:14 UTC-5, rochacbruno wrote:
>
> Hi,
>
> I was playing a lot with routes, router and rewrite.py to reach url
> rewriting for translation but I am missing something.
>
> I have a controller:
>
> # *default*.py
>
>
>> *def articles(): from handlers import articles*
>
> * response.view = articles.views['list']*
>
> * return articles.list*
>
>
> This action can be accessed in: *http://....../app/default/articles*
>
> I want the application to be translated including the urls.
>
> So in english
> http://....../app/*default*/*articles*
>
> in portuguese:
> http://....../app/*inicio*/*artigos*
>
> In spanish
> http://....../app/*principal*/*articulos*
>
> In Estonian
> http://....../app/*peamine*/*artiklid*
>
> Using routes.py, how can I make all the above urls to call default.py:
> articles function ?
>
> Thanks
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>
--
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.