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

Add mechanism to translate URLs #181

Open
pokoli opened this issue May 1, 2014 · 0 comments
Open

Add mechanism to translate URLs #181

pokoli opened this issue May 1, 2014 · 0 comments

Comments

@pokoli
Copy link

pokoli commented May 1, 2014

As started on #122 we may add a mechanism to add translation to the URL, so an url can be localized.

With the new route decorator introduced on #178, we can use something like:

@route('/product/<uri>')
@route_translation('es_ES', '/producto/<uri>')
def product(self):

This will generate a default route for es_US ('/product/<uri>) and another route for es_ES (`'/producto/').

With this information, we should generate the routes based on website default locale, and website locales. So the following cases will occur.

If website has no locales and website default locale is en_US, the url_for product method must return '/product/<uri>.

If website has no locales and website default locale is es_ES, the url_for product method must return '/producto/<uri>.

If website has multiple locales, the url_for must return the slug in the current transaction locale, prefixed with the variable.

Just started a PoC on https://github.com/pokoli/nereid/tree/route_translations but i think is not as easy as I thought.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1930624-add-mechanism-to-translate-urls?utm_campaign=plugin&utm_content=tracker%2F386869&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F386869&utm_medium=issues&utm_source=github).
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

2 participants