Skip to content

Commit 88bdbb8

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: [#12861] Tweaked translation docs for 4.4 component changes [#12861] Tweak translation articles for 4.3 component changes
2 parents 97dbd5a + 98da366 commit 88bdbb8

File tree

2 files changed

+41
-46
lines changed

2 files changed

+41
-46
lines changed

translation.rst

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,6 @@ use for translation::
321321
'fr_FR'
322322
);
323323

324-
$translator->transChoice(
325-
'{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
326-
10,
327-
[],
328-
'messages',
329-
'fr_FR'
330-
);
331-
332324
Extracting Translation Contents and Updating Catalogs Automatically
333325
-------------------------------------------------------------------
334326

@@ -478,56 +470,60 @@ to learn more about how to handle it.
478470
Fallback Translation Locales
479471
----------------------------
480472

481-
Imagine that the user's locale is ``fr_FR`` and that you're translating the
482-
key ``Symfony is great``. To find the French translation, Symfony actually
473+
Imagine that the user's locale is ``es_AR`` and that you're translating the
474+
key ``Symfony is great``. To find the Spanish translation, Symfony actually
483475
checks translation resources for several locales:
484476

485-
#. First, Symfony looks for the translation in a ``fr_FR`` translation resource
486-
(e.g. ``messages.fr_FR.xlf``);
477+
#. First, Symfony looks for the translation in a ``es_AR`` (Argentinean
478+
Spanish) translation resource (e.g. ``messages.es_AR.yaml``);
479+
480+
#. If it wasn't found, Symfony looks for the translation in the
481+
parent locale, which is automatically defined only for some locales. In
482+
this example, the parent locale is ``es_419`` (Latin American Spanish);
487483

488-
#. If it wasn't found, Symfony looks for the translation in a ``fr`` translation
489-
resource (e.g. ``messages.fr.xlf``);
484+
#. If it wasn't found, Symfony looks for the translation in a ``es``
485+
(Spanish) translation resource (e.g. ``messages.es.yaml``);
490486

491487
#. If the translation still isn't found, Symfony uses the ``fallbacks`` option,
492488
which can be configured as follows:
493489

494-
.. configuration-block::
490+
.. configuration-block::
495491

496-
.. code-block:: yaml
492+
.. code-block:: yaml
497493
498-
# config/packages/translation.yaml
499-
framework:
500-
translator:
501-
fallbacks: ['en']
502-
# ...
494+
# config/packages/translation.yaml
495+
framework:
496+
translator:
497+
fallbacks: ['en']
498+
# ...
503499
504-
.. code-block:: xml
500+
.. code-block:: xml
505501
506-
<!-- config/packages/translation.xml -->
507-
<?xml version="1.0" encoding="UTF-8" ?>
508-
<container xmlns="http://symfony.com/schema/dic/services"
509-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
510-
xmlns:framework="http://symfony.com/schema/dic/symfony"
511-
xsi:schemaLocation="http://symfony.com/schema/dic/services
512-
https://symfony.com/schema/dic/services/services-1.0.xsd
513-
http://symfony.com/schema/dic/symfony
514-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
502+
<!-- config/packages/translation.xml -->
503+
<?xml version="1.0" encoding="UTF-8" ?>
504+
<container xmlns="http://symfony.com/schema/dic/services"
505+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
506+
xmlns:framework="http://symfony.com/schema/dic/symfony"
507+
xsi:schemaLocation="http://symfony.com/schema/dic/services
508+
https://symfony.com/schema/dic/services/services-1.0.xsd
509+
http://symfony.com/schema/dic/symfony
510+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
515511
516-
<framework:config>
517-
<framework:translator>
518-
<framework:fallback>en</framework:fallback>
519-
<!-- ... -->
520-
</framework:translator>
521-
</framework:config>
522-
</container>
512+
<framework:config>
513+
<framework:translator>
514+
<framework:fallback>en</framework:fallback>
515+
<!-- ... -->
516+
</framework:translator>
517+
</framework:config>
518+
</container>
523519
524-
.. code-block:: php
520+
.. code-block:: php
525521
526-
// config/packages/translation.php
527-
$container->loadFromExtension('framework', [
528-
'translator' => ['fallbacks' => ['en']],
529-
// ...
530-
]);
522+
// config/packages/translation.php
523+
$container->loadFromExtension('framework', [
524+
'translator' => ['fallbacks' => ['en']],
525+
// ...
526+
]);
531527
532528
.. note::
533529

@@ -582,7 +578,6 @@ Learn more
582578
.. _`i18n`: https://en.wikipedia.org/wiki/Internationalization_and_localization
583579
.. _`ICU MessageFormat`: http://userguide.icu-project.org/formatparse/messages
584580
.. _`ISO 3166-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
585-
.. _`ISO 31-11`: https://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals
586581
.. _`ISO 639-1`: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
587582
.. _`Translatable Extension`: http://atlantic18.github.io/DoctrineExtensions/doc/translatable.html
588583
.. _`Translatable Behavior`: https://github.com/KnpLabs/DoctrineBehaviors

translation/xliff.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ loaded/dumped inside a Symfony application:
2727
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.1" version="2.1"
2828
srcLang="fr-FR" trgLang="en-US">
2929
<file id="messages.en_US">
30-
<unit id="LCa0a2j">
30+
<unit id="LCa0a2j" name="original-content">
3131
<notes>
3232
<note category="state">new</note>
3333
<note category="approved">true</note>

0 commit comments

Comments
 (0)