Commit 49f00191 authored by Benoit Pointet's avatar Benoit Pointet

updated tranlation doc with XLIFF and twig infos

parent 8835a38d
......@@ -124,3 +124,25 @@ of the default ``ArrayLoader``::
$app['translator.loader'] = new Symfony\Component\Translation\Loader\YamlFileLoader();
And that's all you need to load translations from YAML files.
XLIFF-based language files
~~~~~~~~~~~~~~~~~~~~~~~~~
Just as you would do with YAML translation files, you first need to make sure you have the ``Config`` component from Symfony2, and that they are registered with the autoloader. See above for details.
Then, similarly, create XLIFF files in your locales directory and setup the ``translator.messages`` to map to them.
Finally override the ``translator.loader`` to use a ``XliffFileLoader``::
$app['translator.loader'] = new Symfony\Component\Translation\Loader\XliffFileLoader();
That's it.
Adding translations in Twig templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The translation service provider is available from within Twig templates:
.. code-block:: twig
{{ app.translator.trans('translation_key') }}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment