Skip to content

Commit f09780d

Browse files
committed
minor #10122 Update translator fallback example to include ICU parents (thewilkybarkid, javiereguiluz)
This PR was merged into the master branch. Discussion ---------- Update translator fallback example to include ICU parents Changes the example to show symfony/symfony#28070. Commits ------- 7ccf603 Reworded and added the versionadded directive 54631df Update translator fallback example to include ICU parents
2 parents 1468994 + 7ccf603 commit f09780d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

components/translation.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,24 @@ Fallback Locales
162162

163163
If the message is not located in the catalog of the specific locale, the
164164
translator will look into the catalog of one or more fallback locales. For
165-
example, assume you're trying to translate into the ``fr_FR`` locale:
165+
example, assume you're trying to translate into the ``es_AR`` locale:
166166

167-
#. First, the translator looks for the translation in the ``fr_FR`` locale;
167+
#. First, the translator looks for the translation in the ``es_AR``
168+
(Argentinean Spanish) locale;
168169

169-
#. If it wasn't found, the translator looks for the translation in the ``fr``
170-
locale;
170+
#. If it wasn't found, the translator looks for the translation in the parent
171+
locale, which is automatically defined only for some locales. In this
172+
example, the parent locale is ``es_419`` (Latin American Spanish);
173+
174+
#. If it wasn't found, the translator looks for the translation in the ``es``
175+
(Spanish) locale;
171176

172177
#. If the translation still isn't found, the translator uses the one or more
173178
fallback locales set explicitly on the translator.
174179

180+
.. versionadded:: 4.2
181+
The use of parent locales was introduced in Symfony 4.2.
182+
175183
For (3), the fallback locales can be set by calling
176184
:method:`Symfony\\Component\\Translation\\Translator::setFallbackLocales`::
177185

0 commit comments

Comments
 (0)