This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Translation
2012-02-27 09:59:20 +01:00
..
Dumper [Translation] Add IcuResFileDumper 2012-02-22 16:15:11 +01:00
Extractor Fix some CheckStyle violations on Components. 2011-11-11 20:46:32 +01:00
Loader [Translation] ResourceBundleLoader to IcuRes/DatFileLoader 2012-02-22 16:14:47 +01:00
Writer fix some translations component phpdocs 2012-01-24 10:12:17 +01:00
composer.json Removed version field 2012-02-27 09:59:20 +01:00
IdentityTranslator.php [Translation] tagged the guaranteed BC API 2011-03-24 09:07:52 +01:00
Interval.php [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
MessageCatalogue.php Merge branch '2.0' 2011-11-11 22:52:07 +01:00
MessageCatalogueInterface.php [Translator] fixed merge with 2.0 2011-09-28 17:13:00 +02:00
MessageSelector.php [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
PluralizationRules.php Fixed various typo 2011-04-22 23:12:50 +00:00
README.md tweaked the README files 2011-12-18 14:22:28 +01:00
Translator.php merged 2.0 2012-02-22 18:59:56 +01:00
TranslatorInterface.php [Translation] tagged the guaranteed BC API 2011-03-24 09:07:52 +01:00

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', return new ArrayLoader());
$translator->addResource('array', array(
    'Hello World!' => 'Bonjour',
), 'fr');

$translator->trans('Hello World!');

Resources

Silex integration:

https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php

Unit tests:

https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/Translation

Documentation:

http://symfony.com/doc/2.0/book/translation.html