On Jun 24, 2012, at 2:41 AM, Ivan Nikiforov wrote:
> I am creating a multilingual application and use this recipe to put language 
> in URLs.
> 
> routers = dict(
>   BASE  = dict(default_application='myapp'),
>   myapp = dict(languages=['en', 'it', 'jp'], default_language='en'),
> )
> 
> It works fine for incoming URLs but the URL function does not add language to 
> the URLs.
> 
> URL('controller', 'function') -> '/controller/function' 
> (wanted'/language/controller/function')
> 
> Of course there is a way to write links, say, this way
> 
> {{='/' + request.uri_language + URL('hubs', 'index')}}
> 
> but it seems more elegant and robust to make the URL function do this. Is 
> this possible?
> 

It should work the way you want if you specify request.uri_language. However, 
the default_language ('en' in your example) will be omitted from the outgoing 
URL, so set default_language to None if you always wan to see the language.

-- 



Reply via email to