I'm trying to utilize Symfony 4's multilang (or multi-locale) routing pattern.
My application is truly international and supports over 25 different languages, though the translations come incrementally and many routes are not translated to some languages yet.
In such case I want them to fall back into english-default.
My config/packages/translation.yaml
looks like this:
framework:
default_locale: en
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en
My routes are defined within routes.yaml
file. For example:
about_index:
path:
en: /about-us
pl: /o-nas
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
defaults:
template: About/index.html.twig
Now, whenever I open the site with either pl
or en
locale - everything works as expected, but when for example I set it to de
, I get "Unable to generate a URL for the named route "about_index" as such route does not exist."
error.
How do I force Symfony to fallback to en
paths whenever the route in desired locale does not yet exist?