@@ -249,27 +249,12 @@ To actually translate the message, Symfony uses a simple process:
249249When using the ``trans() `` method, Symfony looks for the exact string inside
250250the appropriate message catalog and returns it (if it exists).
251251
252- .. _using-message-domains :
253-
254- Using Message Domains
255- ~~~~~~~~~~~~~~~~~~~~~
256-
257- As you've seen, message files are organized into the different locales that
258- they translate. The message files can also be organized further into "domains".
259-
260- The domain is the filename without the extension. The default domain is
261- ``messages ``. Translations can for example be split into three different
262- domains: ``messages ``, ``admin `` and ``navigation ``. The French translation
263- would be organized in these files:
264-
265- * ``app/Resources/translations/messages.fr.yml ``
266- * ``app/Resources/translations/admin.fr.yml ``
267- * ``app/Resources/translations/navigation.fr.yml ``
252+ .. tip ::
268253
269- When translating strings that are not in the default domain (``messages ``),
270- you must specify the domain as the third argument of ``trans() ``::
254+ When translating strings that are not in the default domain (``messages ``),
255+ you must specify the domain as the third argument of ``trans() ``::
271256
272- $translator->trans('Symfony is great', [], 'admin');
257+ $translator->trans('Symfony is great', [], 'admin');
273258
274259Message Placeholders
275260~~~~~~~~~~~~~~~~~~~~
@@ -520,18 +505,18 @@ works when you use a placeholder following the ``%var%`` pattern.
520505 If you need to use the percent character (``% ``) in a string, escape it by
521506 doubling it: ``{% trans %}Percent: %percent%%%{% endtrans %} ``
522507
523- You can also specify the message domain and pass some additional variables :
508+ You can also pass some additional variables and specify the message domain :
524509
525510.. code-block :: twig
526511
527- {% trans with {'%name%': 'Fabien'} from 'app' %}Hello %name%{% endtrans %}
528-
529- {% trans with {'%name%': 'Fabien'} from 'app' into 'fr' %}Hello %name%{% endtrans %}
512+ {% trans with {'%name%': 'Fabien'} into 'fr' %}Hello %name%{% endtrans %}
530513
531- {% transchoice count with {'%name%': 'Fabien'} from 'app' %}
514+ {% transchoice count with {'%name%': 'Fabien'} %}
532515 {0} %name%, there are no apples|{1} %name%, there is one apple|]1,Inf[ %name%, there are %count% apples
533516 {% endtranschoice %}
534517
518+ {% trans with {'%name%': 'Fabien'} from 'custom_domain' %}Hello %name%{% endtrans %}
519+
535520 .. _translation-filters :
536521
537522The ``trans `` and ``transchoice `` filters can be used to translate *variable
@@ -670,8 +655,9 @@ priority message files.
670655The filename of the translation files is also important: each message file
671656must be named according to the following path: ``domain.locale.loader ``:
672657
673- * **domain **: An optional way to organize messages into groups (e.g. ``admin ``,
674- ``navigation `` or the default ``messages ``) - see :ref: `using-message-domains `;
658+ * **domain **: An optional way to organize messages into groups. Unless
659+ parts of the application are explicitly separated from each other, it is
660+ recommended to only use default ``messages `` domain;
675661
676662* **locale **: The locale that the translations are for (e.g. ``en_GB ``, ``en ``, etc);
677663
0 commit comments