587f355137
* 2.3: (25 commits) bumped Symfony version to 2.2.11 updated VERSION for 2.2.10 update CONTRIBUTORS for 2.2.10 updated CHANGELOG for 2.2.10 fixed version Request::overrideGlobals() may call invalid ini value Force Luhn Validator to only work with strings Fixed bug with lazy services [Translation] fixed the error in the dumper test as described in #9475 deleted mixing string concatenation inside a sprintf "__call()" should be displayed only if $this->magicCall is true [Console] fix phpdoc and constructor default value Add media-query for printing: Do not print the toolbar. Fix ProgressHelper redraw when redrawFreq is greater than 1 Update toolbar.css.twig slovenian translations fixed slovenian translations fixed [DependencyInjection] fixed YamlDumper did not make services private. [FrameworkBundle] fix routing container parameter exception message [Form] fix and unify phpdoc ... Conflicts: src/Symfony/Component/Console/Helper/ProgressHelper.php src/Symfony/Component/DependencyInjection/ContainerBuilder.php src/Symfony/Component/HttpKernel/Kernel.php |
||
---|---|---|
.. | ||
Catalogue | ||
Dumper | ||
Exception | ||
Extractor | ||
Loader | ||
Tests | ||
Writer | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
IdentityTranslator.php | ||
Interval.php | ||
LICENSE | ||
MessageCatalogue.php | ||
MessageCatalogueInterface.php | ||
MessageSelector.php | ||
MetadataAwareInterface.php | ||
phpunit.xml.dist | ||
PluralizationRules.php | ||
README.md | ||
Translator.php | ||
TranslatorInterface.php |
Translation Component
Translation provides tools for loading translation files and generating translated strings from these including support for pluralization.
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\MessageSelector;
use Symfony\Component\Translation\Loader\ArrayLoader;
$translator = new Translator('fr_FR', new MessageSelector());
$translator->setFallbackLocales(array('fr'));
$translator->addLoader('array', new ArrayLoader());
$translator->addResource('array', array(
'Hello World!' => 'Bonjour',
), 'fr');
echo $translator->trans('Hello World!')."\n";
Resources
Silex integration:
https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php
Documentation:
http://symfony.com/doc/2.4/book/translation.html
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/Translation/
$ composer.phar install
$ phpunit