ss 33d2a96cf2 初始化 | 5 months ago | |
---|---|---|
.. | ||
Catalogue | 5 months ago | |
Command | 5 months ago | |
DataCollector | 5 months ago | |
DependencyInjection | 5 months ago | |
Dumper | 5 months ago | |
Exception | 5 months ago | |
Extractor | 5 months ago | |
Formatter | 5 months ago | |
Loader | 5 months ago | |
Reader | 5 months ago | |
Resources | 5 months ago | |
Util | 5 months ago | |
Writer | 5 months ago | |
CHANGELOG.md | 5 months ago | |
DataCollectorTranslator.php | 5 months ago | |
IdentityTranslator.php | 5 months ago | |
Interval.php | 5 months ago | |
LICENSE | 5 months ago | |
LoggingTranslator.php | 5 months ago | |
MessageCatalogue.php | 5 months ago | |
MessageCatalogueInterface.php | 5 months ago | |
MessageSelector.php | 5 months ago | |
MetadataAwareInterface.php | 5 months ago | |
PluralizationRules.php | 5 months ago | |
README.md | 5 months ago | |
Translator.php | 5 months ago | |
TranslatorBagInterface.php | 5 months ago | |
TranslatorInterface.php | 5 months ago | |
composer.json | 5 months ago |
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 ! »