Skip to content

Commit 2a21457

Browse files
committed
minor #10108 [Routing] Add locale fallback to internationalized routes (Thomas Calvet, javiereguiluz)
This PR was merged into the master branch. Discussion ---------- [Routing] Add locale fallback to internationalized routes Related PR : symfony/symfony#27957 Commits ------- 02cc739 Minor reword c15df9d [Routing] Add locale fallback to internationalized routes
2 parents f09780d + 02cc739 commit 2a21457

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

routing.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ should be used during the request. Defining routes this way also eliminated the
214214
need for duplicate registration of routes which minimizes the risk for any bugs
215215
caused by definition inconsistency.
216216

217+
.. tip::
218+
219+
If the application uses full language + territory locales (e.g. ``fr_FR``,
220+
``fr_BE``), you can use the language part only in your routes (e.g. ``fr``).
221+
This prevents having to define multiple paths when you want to use the same
222+
route path for locales that share the same language.
223+
224+
.. versionadded:: 4.2
225+
The feature to fall back on the language part only was introduced in Symfony 4.2.
226+
217227
A common requirement for internationalized applications is to prefix all routes
218228
with a locale. This can be done by defining a different prefix for each locale
219229
(and setting an empty prefix for your default locale if you prefer it):

0 commit comments

Comments
 (0)