Closed
Description
Symfony version(s) affected: 4.1.5
Description
When defining i18n routes, with only a language and not a combination of language and region, the fallback mechanism via _canonical_route does not work, when the locale contains both language and region.
How to reproduce
locale: en_US
petition_show:
path:
de: /petitionen/{id}/{slug}
en: /petitions/{id}/{slug}
$this->generateUrl('petition_show', ...
Gives the error:
Unable to generate a URL for the named route "petition_show" as such route does not exist.
Possible Solution
UrlGenerator::generate should check both the full locale and only the language part of the locale.
This would have to be reflected in PhpGeneratorDumper::generateGenerateMethod.
Additional context
This would be the same behaviour as the for example the translator works.
Metadata
Metadata
Assignees
Labels
No labels