Hi all,

I am trying to have my routes in several languages (/en/products, 
/es/productos, etc) but I can't come up with an
easy way of doing that.

One option would be to write all the routes in every language, but that 
would be too cumbersome since
it is not possible to link two routes with the same name and different 
paths.
    
config.add_route('products',  '/en/products/{id:\d+}', ...)
config.add_route('productos', '/es/productos/{id:\d+}', ...)
...
@view_config(route_name='products')
@view_config(route_name='productos')
def products(self):
...

If the replacement markers are strings instead of numbers, well, it gets 
harder. And in the real
application replacement markers are being used heavily.

So, the question: is there any way of having the route automagically 
translated to the default language?
What I would like to do is something similar to

config.add_route('products',  _('/{language}/products/{id:\d+}'), ...)
...
@view_config(route_name='products')
def products(self):

but I'm afraid it will add the (translated) routes when loaded, and not all 
the routes.

Of course, if this is not possible, I will have /{language}/products 
(products will appear only in english)
as a path, but I would like to know if there are more options.

The only somewhat related information that I have found are these two 
articles:
http://codeistan.com/2012/02/18/localization-in-pyramid.html
http://my.opera.com/WebApplications/blog/2008/03/17/search-engine-friendly

however, I have seen that in other web frameworks it is possible (with some 
effort) to do this,
so that led me to think that maybe I'm missing something really obvious 
about Pyramid here.

Thank you very much.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to