The Wayback Machine - https://web.archive.org/web/20221102135435/https://github.com/symfony/translation
Skip to content

symfony/translation

6.1
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

* 6.0:
  [Console] Fix `Helper::removeDecoration` hyperlink bug
  Guard scripts from being run in non-CLI contexts
  Guard scripts from being run in non-CLI contexts
  a readonly property must not be reported as being writable
e6cd330

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

Sponsor

The Translation component for Symfony 6.1 is backed by:

  • Crowdin, a cloud-based localization management software helping teams to go global and stay agile.

Help Symfony by sponsoring its development!

Resources