I want to translate my routes.
I used the I18N Subdomains and URL rules tutorial from the wiki.
Now I can switch the language and the urls are correctly translated.
In the views I want to create a link to /contact. But how to do this dynamically? Is it possible to get the correct path backward from the urlManager?
in fact it is working like that already.
If I add a route in the main.php:
'kontakt' => 'site/contact'
And try to generate an url:
<?php echo $this->createUrl('site/contact')); ?>
It returns example.com/site/contact
it depends where you add this rule. First matching rule wins, so try to add it as first rule and check again. Also try absolute notation: $this->createUrl(’/site/contact’));
Problem was, the default routes matched the URLs before the custom translated routes.