I was digging into how to improve this ... and realized that if we use the standard enabled_locales config option from Symfony, the {_locale} parameter included in the URLs is automatically restricted to those values.
So, we can simplify code by moving to enabled_locales without losing any functionality.
I never liked the
app_locales
parameter: https://github.com/symfony/demo/blob/main/config/services.yaml#L9But we need it for the route locale requirements.
I was digging into how to improve this ... and realized that if we use the standard enabled_locales config option from Symfony, the
{_locale}
parameter included in the URLs is automatically restricted to those values.So, we can simplify code by moving to
enabled_locales
without losing any functionality.