Skip to content

Commit ad0253c

Browse files
committed
minor #19777 [FrameworkBundle][Routing] Update the enabled_locales description (javiereguiluz)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle][Routing] Update the `enabled_locales` description While working on symfony/demo#1511 I found this feature, which works since Symfony 5.4. See: https://github.com/symfony/symfony/blob/184597db05288c68c9eb11dff55239768268f646/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L1083-L1086 Commits ------- c9b92b3 [FrameworkBundle] Update the enabled_locales description
2 parents 2a66547 + c9b92b3 commit ad0253c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

reference/configuration/framework.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,11 @@ performance a bit:
428428
$framework->enabledLocales(['en', 'es']);
429429
};
430430
431-
If some user makes requests with a locale not included in this option, the
432-
application won't display any error because Symfony will display contents using
433-
the fallback locale.
431+
An added bonus of defining the enabled locales is that they are automatically
432+
added as a requirement of the :ref:`special _locale parameter <routing-locale-parameter>`.
433+
For example, if you define this value as ``['ar', 'he', 'ja', 'zh']``, the
434+
``_locale`` routing parameter will have an ``ar|he|ja|zh`` requirement. If some
435+
user makes requests with a locale not included in this option, they'll see an error.
434436

435437
set_content_language_from_locale
436438
................................

0 commit comments

Comments
 (0)