This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/vendor/symfony/translation
2015-11-17 16:48:54 -08:00
..
Catalogue Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
DataCollector Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
Dumper Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
Exception Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
Extractor Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
Loader Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
Writer Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
.gitignore Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
CHANGELOG.md Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
composer.json Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
DataCollectorTranslator.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
IdentityTranslator.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
Interval.php Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
LICENSE Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
LoggingTranslator.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
MessageCatalogue.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
MessageCatalogueInterface.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
MessageSelector.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
MetadataAwareInterface.php Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
phpunit.xml.dist Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
PluralizationRules.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
README.md Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
Translator.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08:00
TranslatorBagInterface.php Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663 2015-10-08 15:13:01 -07:00
TranslatorInterface.php Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation. 2015-11-17 16:48:54 -08: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->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/silexphp/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php

Documentation:

https://symfony.com/doc/2.7/book/translation.html

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/Translation/
$ composer install
$ phpunit