@@ -67,6 +67,8 @@ may also be tags in other bundles you use that aren't listed here.
6767+-----------------------------------+---------------------------------------------------------------------------+
6868| `translation.extractor `_| Register a custom service that extracts translation messages from a file|
6969+-----------------------------------+---------------------------------------------------------------------------+
70+ | `translation.dumper `_| Register a custom service that dumps translation messages|
71+ +-----------------------------------+---------------------------------------------------------------------------+
7072| `twig.extension `_| Register a custom Twig Extension|
7173+-----------------------------------+---------------------------------------------------------------------------+
7274| `validator.constraint_validator `_| Create your own custom validation constraint|
@@ -988,6 +990,60 @@ option: ``alias``, this defines the name of the extractor.
988990 )
989991 ->addTag('translation.extractor', array('alias' => 'foo'));
990992
993+ translation.dumper
994+ ------------------
995+
996+ **Purpose**: To register a custom service that dumps messages to a file
997+
998+ .. versionadded:: 2.1
999+ The ability to add message dumpers is new to 2.1
1000+
1001+ After an `Extractor <translation.extractor>`_ has extracted all messages from
1002+ the templates, the dumpers are executed to dump the messages to a translation
1003+ file in a specific format.
1004+
1005+ Symfony2 comes already with many dumpers:
1006+
1007+ * :class:`Symfony\\Component\\Translation\\Dumper\\CsvFileDumper`
1008+ * :class:`Symfony\\Component\\Translation\\Dumper\\IcuResFileDumper`
1009+ * :class:`Symfony\\Component\\Translation\\Dumper\\IniFileDumper`
1010+ * :class:`Symfony\\Component\\Translation\\Dumper\\MoFileDumper`
1011+ * :class:`Symfony\\Component\\Translation\\Dumper\\PoFileDumper`
1012+ * :class:`Symfony\\Component\\Translation\\Dumper\\QtFileDumper`
1013+ * :class:`Symfony\\Component\\Translation\\Dumper\\XliffFileDumper`
1014+ * :class:`Symfony\\Component\\Translation\\Dumper\\YamlFileDumper`
1015+
1016+ You can create your own dumper by extending
1017+ :class:`Symfony\\Component\\Translation\\DumperFileDumper` or implementing
1018+ :class:`Symfony\\Component\\Translation\\Dumper\\DumperInterface` and tagging
1019+ the service with ``translation.dumper``. The tag has one option: ``alias``
1020+ This is the name that's used to determine which dumper should be used.
1021+
1022+ .. configuration-block::
1023+
1024+ .. code-block:: yaml
1025+
1026+ services:
1027+ acme_demo.translation.dumper.json:
1028+ class: Acme\DemoBundle\Translation\JsonFileDumper
1029+ tags:
1030+ - { name: translation.dumper, alias: json }
1031+
1032+ .. code-block:: xml
1033+
1034+ <service id=" acme_demo.translation.dumper.json"
1035+ class=" Acme\DemoBundle\Translation\JsonFileDumper" >
1036+ <tag name=" translation.dumper" alias=" json" />
1037+ </service>
1038+
1039+ .. code-block:: php
1040+
1041+ $container->register(
1042+ 'acme_demo.translation.dumper.json',
1043+ 'Acme\DemoBundle\Translation\JsonFileDumper'
1044+ )
1045+ ->addTag('translation.dumper', array('alias' => 'json'));
1046+
9911047.. _reference-dic-tags-twig-extension:
9921048
9931049twig.extension