Skip to content
5.3
Switch branches/tags
Code

Latest commit

* 5.2:
  Fix incompatible implicit float-to-int conversions
  [Translation] Don't pass null to strtoupper()
  cs fix
  [String] Fix implicit float-to-int casts
  [DependencyInjection] Don't pass null to trim()
  Add return types to JsonSerializable implementations
  Fix Serializable deprecations triggered by token mocks
  Add missing security translations
7e2603b

Git stats

Files

Permalink
Failed to load latest commit information.

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