Use allowed_locales in routing.yml
Any idea how to get this working?
resource: "@ExampleBundle/Resources/config/routing.yml"
prefix: /{_locale}
requirements:
_locale: %lunetics_locale.allowed_locales%
Error:
The container parameter "lunetics_locale.allowed_locales", used in the route configuration value "%lunetics_locale.allowed_locales%", must be a string or numeric, but it is of type array.
maybe with the expression language, if you are on symfony 2.4 or higher?
You could add another variable with _regex% suffix and transform it into a regex string in the configurations Am 24.04.2015 09:11 schrieb "JHGitty" [email protected]:
Any idea how to get this working?
resource: "@ExampleBundle/Resources/config/routing.yml" prefix: /{_locale} requirements: _locale: %lunetics_locale.allowed_locales%
Error:
The container parameter "lunetics_locale.allowed_locales", used in the route configuration value "%lunetics_locale.allowed_locales%", must be a string or numeric, but it is of type array.
— Reply to this email directly or view it on GitHub https://github.com/lunetics/LocaleBundle/issues/148.
Is there any other way to add the prefix?
@JHGitty those 2 methods seem to me the most obvious ones, can't think of others. you would need to make the implode function available for expressions and use that.
I think it would be great if the documentation would contain an example for this. There is already an example for subdomains.