@@ -1029,32 +1029,12 @@ translation.loader
10291029**Purpose**: To register a custom service that loads translations
10301030
10311031By default, translations are loaded from the filesystem in a variety of different
1032- formats (YAML, XLIFF, PHP, etc). If you need to load translations from some
1033- other source, first create a class that implements the
1034- :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface::
1032+ formats (YAML, XLIFF, PHP, etc).
10351033
1036- // src/Acme/MainBundle/Translation/MyCustomLoader.php
1037- namespace Acme\MainBundle\Translation;
1038-
1039- use Symfony\Component\Translation\Loader\LoaderInterface;
1040- use Symfony\Component\Translation\MessageCatalogue;
1041-
1042- class MyCustomLoader implements LoaderInterface
1043- {
1044- public function load($resource, $locale, $domain = 'messages')
1045- {
1046- $catalogue = new MessageCatalogue($locale);
1047-
1048- // some how load up some translations from the " resource"
1049- // then set them into the catalogue
1050- $catalogue->set('hello.world', 'Hello World!', $domain);
1051-
1052- return $catalogue;
1053- }
1054- }
1034+ .. seealso::
10551035
1056- Your custom loader's ``load`` method is responsible for returning a
1057- :Class:`Symfony\\Component\\Translation\\MessageCatalogue` .
1036+ Learn how to :ref:`load custom formats <components-translation-custom-loader>`
1037+ in the components section .
10581038
10591039Now, register your loader as a service and tag it with ``translation.loader``:
10601040
@@ -1252,6 +1232,11 @@ This is the name that's used to determine which dumper should be used.
12521232 )
12531233 ->addTag('translation.dumper', array('alias' => 'json'));
12541234
1235+ .. seealso::
1236+
1237+ Learn how to :ref:`dump to custom formats <components-translation-custom-dumper>`
1238+ in the components section.
1239+
12551240.. _reference-dic-tags-twig-extension:
12561241
12571242twig.extension
0 commit comments