wangsaitao b6131e421c 提交 | 1 rok pred | |
---|---|---|
.. | ||
Catalogue | 1 rok pred | |
Command | 1 rok pred | |
DataCollector | 1 rok pred | |
DependencyInjection | 1 rok pred | |
Dumper | 1 rok pred | |
Exception | 1 rok pred | |
Extractor | 1 rok pred | |
Formatter | 1 rok pred | |
Loader | 1 rok pred | |
Reader | 1 rok pred | |
Resources | 1 rok pred | |
Util | 1 rok pred | |
Writer | 1 rok pred | |
CHANGELOG.md | 1 rok pred | |
DataCollectorTranslator.php | 1 rok pred | |
IdentityTranslator.php | 1 rok pred | |
Interval.php | 1 rok pred | |
LICENSE | 1 rok pred | |
LoggingTranslator.php | 1 rok pred | |
MessageCatalogue.php | 1 rok pred | |
MessageCatalogueInterface.php | 1 rok pred | |
MessageSelector.php | 1 rok pred | |
MetadataAwareInterface.php | 1 rok pred | |
PluralizationRules.php | 1 rok pred | |
README.md | 1 rok pred | |
Translator.php | 1 rok pred | |
TranslatorBagInterface.php | 1 rok pred | |
TranslatorInterface.php | 1 rok pred | |
composer.json | 1 rok pred |
The Translation component provides tools to internationalize your application.
$ composer require symfony/translation
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\ArrayLoader;
$translator = new Translator('fr_FR');
$translator->addLoader('array', new ArrayLoader());
$translator->addResource('array', [
'Hello World!' => 'Bonjour !',
], 'fr_FR');
echo $translator->trans('Hello World!'); // outputs « Bonjour ! »