@@ -1043,32 +1043,12 @@ translation.loader
10431043**Purpose**: To register a custom service that loads translations
10441044
10451045By default, translations are loaded from the filesystem in a variety of different
1046- formats (YAML, XLIFF, PHP, etc). If you need to load translations from some
1047- other source, first create a class that implements the
1048- :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface::
1046+ formats (YAML, XLIFF, PHP, etc).
10491047
1050- // src/Acme/MainBundle/Translation/MyCustomLoader.php
1051- namespace Acme\MainBundle\Translation;
1052-
1053- use Symfony\Component\Translation\Loader\LoaderInterface;
1054- use Symfony\Component\Translation\MessageCatalogue;
1055-
1056- class MyCustomLoader implements LoaderInterface
1057- {
1058- public function load($resource, $locale, $domain = 'messages')
1059- {
1060- $catalogue = new MessageCatalogue($locale);
1061-
1062- // some how load up some translations from the " resource"
1063- // then set them into the catalogue
1064- $catalogue->set('hello.world', 'Hello World!', $domain);
1065-
1066- return $catalogue;
1067- }
1068- }
1048+ .. seealso::
10691049
1070- Your custom loader's ``load`` method is responsible for returning a
1071- :Class:`Symfony\\Component\\Translation\\MessageCatalogue` .
1050+ Learn how to :ref:`load custom formats <components-translation-custom-loader>`
1051+ in the components section .
10721052
10731053Now, register your loader as a service and tag it with ``translation.loader``:
10741054
@@ -1260,6 +1240,11 @@ This is the name that's used to determine which dumper should be used.
12601240 )
12611241 ->addTag('translation.dumper', array('alias' => 'json'));
12621242
1243+ .. seealso::
1244+
1245+ Learn how to :ref:`dump to custom formats <components-translation-custom-dumper>`
1246+ in the components section.
1247+
12631248.. _reference-dic-tags-twig-extension:
12641249
12651250twig.extension
0 commit comments