drupal/core/vendor/symfony/translation
Alex Pott e3d0b79f1c Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
..
Catalogue Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
DataCollector Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Dumper Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Exception Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Extractor Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Loader Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Tests Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Writer Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
.gitignore Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
CHANGELOG.md Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
DataCollectorTranslator.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
IdentityTranslator.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Interval.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
LICENSE Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
LoggingTranslator.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
MessageCatalogue.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
MessageCatalogueInterface.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
MessageSelector.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
MetadataAwareInterface.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
PluralizationRules.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
README.md Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
Translator.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
TranslatorBagInterface.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
TranslatorInterface.php Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
composer.json Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00
phpunit.xml.dist Issue #2546618 followup by plach: Document that we don't depend on the Symfony Translation component. 2015-09-11 21:06:36 +01:00

README.md

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