Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path-aware language negotiator #37

Open
miohtama opened this issue Nov 5, 2016 · 3 comments
Open

Path-aware language negotiator #37

miohtama opened this issue Nov 5, 2016 · 3 comments
Milestone

Comments

@miohtama
Copy link

miohtama commented Nov 5, 2016

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

@fizyk fizyk added this to the v0.2 milestone Nov 5, 2016
@fizyk
Copy link
Owner

fizyk commented Nov 5, 2016

@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

@k4ml
Copy link

k4ml commented Jul 20, 2022

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?

@fizyk
Copy link
Owner

fizyk commented Nov 21, 2022

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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants