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

Impossible to use language parameter to tranlsate urls? #52

Closed
ettolo opened this issue Nov 12, 2015 · 2 comments
Closed

Impossible to use language parameter to tranlsate urls? #52

ettolo opened this issue Nov 12, 2015 · 2 comments

Comments

@ettolo
Copy link

ettolo commented Nov 12, 2015

Hi,
your extension works well for me unless i need to translate urls for seo purposes.
For example:
'http://mysite.com/en/user' should become 'http://mysite.com/it/utente';

i could wite these rules in urlManager:
language:it/utente => /user/index
language:en/user=> /user/index

but this won't work because the language parameter is stripped from the url before the rules are applied.
Am i missing something?
Thank you!

@mikehaertl
Copy link
Collaborator

If you use this extension, you can't use URL rules that also use the language parameter. That's by design. In your case you'd probably want to use a custom UrlRule class and deal with language specific URLs there. The language is already set in Yii::$app->language at that point. http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#creating-rules

@ettolo
Copy link
Author

ettolo commented Nov 12, 2015

Thank you!

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

No branches or pull requests

2 participants