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-01-24 10:12:17 +01:00
..
Dumper changed the default XLIFF extension to .xlf instead of .xliff (this is BC and .xliff files are still valid) 2011-12-07 22:39:27 +01:00
Extractor Fix some CheckStyle violations on Components. 2011-11-11 20:46:32 +01:00
Loader fix some translations component phpdocs 2012-01-24 10:12:17 +01:00
Writer fix some translations component phpdocs 2012-01-24 10:12:17 +01:00
composer.json Revert "merged 2.0" 2012-01-08 20:43:02 +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 added LICENSE files for the subtree repositories 2011-02-22 18:58:15 +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 fixed some phpdoc 2012-01-11 15:52:51 +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