11..index ::
22 single: Translation; Custom formats
33
4- Customformats
4+ CustomFormats
55==============
66
77Sometimes, you need to deal with custom formats for translation files. The
@@ -10,19 +10,23 @@ loader (to load translations) and, optionally, a dumper (to dump translations).
1010
1111Let's imagine you have a custom format where translation messages are defined
1212using one line for each translation and parenthesis to wrap the key and the
13- message. A translation file would look like this::
13+ message. A translation file would look like this:
14+
15+ ..code-block ::text
1416
1517 (welcome)(Bienvenido)
1618 (goodbye)(Adios)
1719 (hello)(Hola)
1820
21+ Custom Loader
22+ -------------
23+
1924To define a custom loader able to read this kind of files, you must create a
2025new class that implements the
21- :class: `Symfony\\ Component\\ Translation\\ Loader\\ LoaderInterface ` interface,
22- which defines a
26+ :class: `Symfony\\ Component\\ Translation\\ Loader\\ LoaderInterface `. The
2327:method: `Symfony\\ Component\\ Translation\\ Loader\\ LoaderInterface::load `
24- method. In the loader, this method will get a filename and parse itto create an
25- array. Then, it will create thecatalog that will be returned::
28+ method will get a filename and parse itinto an array. Then, it will
29+ create thecatalogue that will be returned::
2630
2731 use Symfony\Component\Translation\MessageCatalogue;
2832 use Symfony\Component\Translation\Loader\LoaderInterface;
@@ -59,8 +63,11 @@ Once created, it can be used as any other loader::
5963
6064It will print *"Bienvenido" *.
6165
62- It is also possible to create a custom dumper for your format. To do so,
63- a new class implementing the
66+ Custom Dumper
67+ -------------
68+
69+ It is also possible to create a custom dumper for your format, useful when using
70+ the extraction commands. To do so, a new class implementing the
6471:class: `Symfony\\ Component\\ Translation\\ Dumper\\ DumperInterface `
6572interface must be created.
6673To write the dump contents into a file, extending the