Commit ac9dd1f2 authored by Benoit Pointet's avatar Benoit Pointet

added shared services

parent ccb0452a
...@@ -121,9 +121,14 @@ to map languages to files:: ...@@ -121,9 +121,14 @@ to map languages to files::
Finally override the ``translator.loader`` to use a ``YamlFileLoader`` instead Finally override the ``translator.loader`` to use a ``YamlFileLoader`` instead
of the default ``ArrayLoader``:: 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. use Symfony\Component\Translation\Loader\YamlFileLoader;
$app['translator.loader'] = $app->share(function () {
return new YamlFileLoader();
});
That's all you need to load translations from YAML files.
XLIFF-based language files XLIFF-based language files
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -136,10 +141,13 @@ Then, similarly, create XLIFF files in your locales directory and setup the ``tr ...@@ -136,10 +141,13 @@ Then, similarly, create XLIFF files in your locales directory and setup the ``tr
Finally override the ``translator.loader`` to use a ``XliffFileLoader``:: Finally override the ``translator.loader`` to use a ``XliffFileLoader``::
$app['translator.loader'] = new Symfony\Component\Translation\Loader\XliffFileLoader(); use Symfony\Component\Translation\Loader\XliffFileLoader;
That's it. $app['translator.loader'] = $app->share(function () {
return new XliffFileLoader();
});
That's it.
Accessing translations in Twig templates Accessing translations in Twig templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
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