4 Translation provides tools for loading translation files and generating
5 translated strings from these including support for pluralization.
7 use Symfony\Component\Translation\Translator;
8 use Symfony\Component\Translation\MessageSelector;
9 use Symfony\Component\Translation\Loader\ArrayLoader;
11 $translator = new Translator('fr_FR', new MessageSelector());
12 $translator->setFallbackLocales(array('fr'));
13 $translator->addLoader('array', new ArrayLoader());
14 $translator->addResource('array', array(
15 'Hello World!' => 'Bonjour',
18 echo $translator->trans('Hello World!')."\n";
25 https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php
29 http://symfony.com/doc/2.3/book/translation.html
31 You can run the unit tests with the following command:
33 $ cd path/to/Symfony/Component/Translation/
34 $ composer.phar install --dev