Open miohtama opened 7 years ago
@miohtama http://pyramid-localize.readthedocs.io/en/latest/advanced.html#localized-urls would this help?
I'm aware though, it could be much better documented
Can you give specific example of this:-
and your routes, you wish to localise should include a LOCALE parameter.
Is it something like this:-
config.add_route("frontend.dashboard", "/", _LOCALE_="en")
But this will give error Unknown predicate values: {'LOCALE': 'en'} (did you mean ). And what if the route need to support more than one locale? Call add_route() multiple times with different locale?
no, not the add_route, the path has to be able to understand it, but you need to create the localized uri for your application.
So it's more like request.route_url("path", _LOCALE_="en")
It is common pattern to carry the content language in URL as
/en/foobar
style path. This strategy is recommended by search engines. This might make sense to be included in pyramid_localize, so I am opening the discussion here.Here is a preliminary gist if one wants to try out this: https://gist.github.com/miohtama/b93fd1ab11353f86e2da2b484d761358