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
Fabien Potencier 5fea563f4a Merge branch '4.4' into 5.2
* 4.4:
  [Validator] Fix return types
  Add translation for Belarusian
  fix parsing calls of methods named "method"
  deal with indented heredoc/nowdoc tokens
  Adding templates for Belarusian
2021-03-04 16:41:09 +01:00
..
Catalogue Merge branch '4.4' into 5.2 2021-02-05 18:02:58 +01:00
Command Merge branch '4.4' into 5.2 2021-02-16 11:13:48 +01:00
DataCollector Merge branch '4.4' into 5.1 2020-12-27 14:04:50 +01:00
DependencyInjection Merge branch '4.4' into 5.1 2020-10-28 22:31:18 +01:00
Dumper Merge branch '4.4' into 5.2 2021-02-25 14:42:30 +01:00
Exception Mark ExceptionInterfaces throwable 2018-08-29 17:58:00 +02:00
Extractor Merge branch '4.4' into 5.2 2021-03-04 16:41:09 +01:00
Formatter Merge branch '3.4' into 4.4 2020-09-02 18:08:58 +02:00
Loader Merge branch '4.4' into 5.2 2021-02-15 19:55:04 +01:00
Reader Remove superfluous phpdoc tags 2019-08-14 13:59:53 +02:00
Resources [String] Check if function exists before declaring it 2021-02-16 11:20:28 +01:00
Tests Merge branch '4.4' into 5.2 2021-03-04 16:41:09 +01:00
Util Merge branch '4.4' into 5.1 2020-11-28 11:57:20 +01:00
Writer Merge branch '3.4' into 4.4 2020-09-02 18:08:58 +02:00
.gitattributes add missing gitattributes for phpunit-bridge 2020-03-27 17:54:36 +01:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md Rename Translatable class to TranslatableMessage 2020-10-07 07:51:02 +02:00
composer.json Fix "provide" declarations 2021-02-06 09:54:26 +01:00
DataCollectorTranslator.php Merge branch '4.4' into 5.1 2020-12-08 18:02:38 +01:00
IdentityTranslator.php [Translator] fix handling plural for floating numbers 2021-01-26 10:07:54 +01:00
LICENSE Bump license year 2021-01-01 10:24:35 +01:00
LoggingTranslator.php Merge branch '3.4' into 4.4 2020-09-02 18:08:58 +02:00
MessageCatalogue.php Merge branch '3.4' into 4.4 2020-09-02 18:08:58 +02:00
MessageCatalogueInterface.php Merge branch '4.4' into 5.1 2020-12-08 18:02:38 +01:00
MetadataAwareInterface.php [5.0] [Translator] Add parameter type-hints where possible 2019-07-05 07:31:44 +02:00
phpunit.xml.dist Bump phpunit XSD version to 5.2 2018-11-11 12:18:13 +01:00
PluralizationRules.php [Translator] fix handling plural for floating numbers 2021-01-26 10:07:54 +01:00
PseudoLocalizationTranslator.php Merge branch '5.1' 2020-09-02 18:27:44 +02:00
README.md Added $translator->addLoader() 2021-01-19 21:09:23 +05:00
TranslatableMessage.php Rename Translatable class to TranslatableMessage 2020-10-07 07:51:02 +02:00
Translator.php Merge branch '5.1' 2020-09-27 05:44:38 +02:00
TranslatorBagInterface.php [5.0] [Translator] Add parameter type-hints where possible 2019-07-05 07:31:44 +02:00

Translation Component

The Translation component provides tools to internationalize your application.

Getting Started

$ 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 ! »

Resources