a6bc12c9c1
* 2.0: updated VERSION for 2.0.17 updated CHANGELOG for 2.0.17 updated vendors for 2.0.17 fixed XML decoding attack vector through external entities prevents injection of malicious doc types disabled network access when loading XML documents refined previous commit prevents injection of malicious doc types standardized the way we handle XML errors Redirects are now absolute Conflicts: CHANGELOG-2.0.md src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php src/Symfony/Component/DomCrawler/Crawler.php src/Symfony/Component/HttpKernel/Kernel.php tests/Symfony/Tests/Component/DependencyInjection/Loader/XmlFileLoaderTest.php tests/Symfony/Tests/Component/Routing/Loader/XmlFileLoaderTest.php tests/Symfony/Tests/Component/Serializer/Encoder/XmlEncoderTest.php tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php tests/Symfony/Tests/Component/Validator/Mapping/Loader/XmlFileLoaderTest.php vendors.php |
||
---|---|---|
.. | ||
Dumper | ||
Extractor | ||
Loader | ||
Tests | ||
Writer | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
IdentityTranslator.php | ||
Interval.php | ||
LICENSE | ||
MessageCatalogue.php | ||
MessageCatalogueInterface.php | ||
MessageSelector.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->setFallbackLocale('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.0/book/translation.html
You can run the unit tests with the following command:
phpunit
If you also want to run the unit tests that depend on other Symfony Components, install dev dependencies before running PHPUnit:
php composer.phar install --dev