From 54631df93456abdca3eb168b24290e061b2d324a Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Fri, 27 Jul 2018 07:31:43 +0100 Subject: [PATCH 1/2] Update translator fallback example to include ICU parents --- components/translation.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/translation.rst b/components/translation.rst index 611de98adff..6180d27cefc 100644 --- a/components/translation.rst +++ b/components/translation.rst @@ -162,12 +162,16 @@ Fallback Locales If the message is not located in the catalog of the specific locale, the translator will look into the catalog of one or more fallback locales. For -example, assume you're trying to translate into the ``fr_FR`` locale: +example, assume you're trying to translate into the ``es_AR`` locale: -#. First, the translator looks for the translation in the ``fr_FR`` locale; +#. First, the translator looks for the translation in the ``es_AR`` + (Argentinean Spanish) locale; -#. If it wasn't found, the translator looks for the translation in the ``fr`` - locale; +#. If it wasn't found, the translator looks for the translation in the + ``es_419`` (Latin American Spanish) locale; + +#. If it wasn't found, the translator looks for the translation in the ``es`` + (Spanish) locale; #. If the translation still isn't found, the translator uses the one or more fallback locales set explicitly on the translator. From 7ccf60392ce18e73268c8678ef567d287ba34f7a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 4 Sep 2018 13:48:25 +0200 Subject: [PATCH 2/2] Reworded and added the versionadded directive --- components/translation.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/translation.rst b/components/translation.rst index 6180d27cefc..9b94e8b710f 100644 --- a/components/translation.rst +++ b/components/translation.rst @@ -167,8 +167,9 @@ example, assume you're trying to translate into the ``es_AR`` locale: #. First, the translator looks for the translation in the ``es_AR`` (Argentinean Spanish) locale; -#. If it wasn't found, the translator looks for the translation in the - ``es_419`` (Latin American Spanish) locale; +#. If it wasn't found, the translator looks for the translation in the parent + locale, which is automatically defined only for some locales. In this + example, the parent locale is ``es_419`` (Latin American Spanish); #. If it wasn't found, the translator looks for the translation in the ``es`` (Spanish) locale; @@ -176,6 +177,9 @@ example, assume you're trying to translate into the ``es_AR`` locale: #. If the translation still isn't found, the translator uses the one or more fallback locales set explicitly on the translator. +.. versionadded:: 4.2 + The use of parent locales was introduced in Symfony 4.2. + For (3), the fallback locales can be set by calling :method:`Symfony\\Component\\Translation\\Translator::setFallbackLocales`::