-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Routing] Add locale fallback to internationalized routes #10108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,6 +210,17 @@ should be used during the request. Defining routes this way also eliminated the | |
need for duplicate registration of routes which minimizes the risk for any bugs | ||
caused by definition inconsistency. | ||
|
||
.. tip:: | ||
|
||
If you use full locales (language + territory) in your application (e.g. `fr_FR`), | ||
you can use the language part only in your routes configurations (e.g. `fr`). | ||
|
||
It also prevents you from repeating yourself when you want to use the same route path | ||
for several full locales that share the same language (e.g. `fr_FR` and `fr_BE`). | ||
|
||
.. versionadded:: 4.2 | ||
The feature to fall back on the language part only was introduced in Symfony 4.2. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fallback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think "fallback" is the noun, and "fall back" the verb (https://english.stackexchange.com/questions/90549/difference-between-fallback-and-fall-back) |
||
|
||
A common requirement for internationalized applications is to prefix all routes | ||
with a locale. This can be done by defining a different prefix for each locale | ||
(and setting an empty prefix for your default locale if you prefer it): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/territory/culture/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this, I took it from Uncyclopedia and the info seems to come from the ISO standard (https://en.wikipedia.org/wiki/Locale_(computer_software)).