The Translation component provides tools to internationalize your application.

Overview

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 5.4/6.0 is backed by:

  • Crowdin, a cloud-based localization management software helping teams to go global and stay agile.
  • Lokalise, a continuous localization and translation management platform that integrates into your development workflow so you can ship localized products, faster.

Help Symfony by sponsoring its development!

Resources

Issues
  • Fix TranslationTrait (issue 44185)

    Fix TranslationTrait (issue 44185)

    https://github.com/symfony/symfony/issues/44185

    opened by tomasz-kusy 4
  • fix locale Thailand

    fix locale Thailand

    fix return 0 only to if number > 1 return 1

    opened by ROKAISAKKON 3
  • Blank between strings

    Blank between strings

    For example Crowdin.com (translation service) does not "see" more than first string if there is no delimiter between strings.

    opened by zaartix 2
  • Update Translator.php setLocale()

    Update Translator.php setLocale()

    Error: Symfony\Component\Debug\Exception\FatalErrorException Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)

    Fix: Removed typing 'string' in Symfony\Contracts\Translation\LocaleAwareInterface::setLocale($locale)

    opened by LucienCorreia 1
  • Fix update existing key with existing +int-icu domain

    Fix update existing key with existing +int-icu domain

    Using php-translation webui interface, I tried to update an existing +int-icu domain but a regular domain was created and the existing key wasn't updated. Looks like in the method I modified, we should have been looking for a potential domain+intl-icu domain and try it

    opened by axi 1
  • Added ArrayLoader

    Added ArrayLoader

    Following the instructions in the README I got this error:

    Fatal error: Uncaught Symfony\Component\Translation\Exception\RuntimeException: No loader is registered for the "array" format. in /var/www/html/vendor/symfony/translation/Translator.php:372 Stack trace: #0 /var/www/html/vendor/symfony/translation/Translator.php(266): Symfony\Component\Translation\Translator->doLoadCatalogue('fr_FR') #1 /var/www/html/vendor/symfony/translation/Translator.php(255): Symfony\Component\Translation\Translator->initializeCatalogue('fr_FR') #2 /var/www/html/vendor/symfony/translation/Translator.php(236): Symfony\Component\Translation\Translator->loadCatalogue('fr_FR') #3 /var/www/html/vendor/symfony/translation/Translator.php(206): Symfony\Component\Translation\Translator->getCatalogue('fr_FR') #4 /var/www/html/index.php(27): Symfony\Component\Translation\Translator->trans('private') #5 {main} thrown in /var/www/html/vendor/symfony/translation/Translator.php on line 372

    I must add ArrayLoader and $translator->addLoader to make it work.

    opened by gmaccario 1
  • Add support for calling 'trans' with ICU formatted messages

    Add support for calling 'trans' with ICU formatted messages

    Motivation:

    $apples = [1 => '1 apple', '# apples'];
    echo _m($apples, ['count' => 0]);
    

    where _m is a wrapper my application is using, but we obviously don't want to replicate many of the effort of this repo, so it relies on trans.

    This wrapper itself could be integrated into Symfony, if deemed appropriate.

    See https://github.com/symfony/symfony/issues/37228

    opened by someonewithpc 1
  • Declaration fixture

    Declaration fixture

    Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)

    opened by xcrm-soft 1
  • add parameter type declaration

    add parameter type declaration

    to conform to changes made: https://github.com/symfony/translation-contracts/commit/8feb81e6bb1a42d6a3b1429c751d291eb6d05297

    using symfony/translation 4.4.0 and symfony/translation-contracts 2.0.1, the following exception is being thrown:

    Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)
    
    opened by timrspratt 1
  • Update composer.json

    Update composer.json

    Remove incompatible version of symfony/translation-contracts.

    Version 2 of translation-contracts adds primitive type declaration which are not included in this version.

    Resolves: Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)

    opened by FrankyFrankFrank 1
Releases(v6.0.2)
  • v6.0.2(Dec 29, 2021)

    Changelog (https://github.com/symfony/translation/compare/v6.0.1...v6.0.2)

    • bug #44816 Use rawurlencode and separate tag setting (danut007ro)
    • bug #44085 Fix TranslationPullCommand with ICU translations (Kocal)
    • bug #44598 Handle the blank-translation in Loco Adapter (kgonella)
    • bug #44474 Fix push keys to lokalise. Closes #… (olegmifle)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.2(Dec 29, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.4.1...v5.4.2)

    • bug #44816 Use rawurlencode and separate tag setting (danut007ro)
    • bug #44085 Fix TranslationPullCommand with ICU translations (Kocal)
    • bug #44598 Handle the blank-translation in Loco Adapter (kgonella)
    • bug #44474 Fix push keys to lokalise. Closes #… (olegmifle)
    Source code(tar.gz)
    Source code(zip)
  • v5.3.13(Dec 29, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.12...v5.3.13)

    • bug #44816 Use rawurlencode and separate tag setting (danut007ro)
    • bug #44085 Fix TranslationPullCommand with ICU translations (Kocal)
    • bug #44598 Handle the blank-translation in Loco Adapter (kgonella)
    • bug #44474 Fix push keys to lokalise. Closes #… (olegmifle)
    • bug #44350 Fix TranslationTrait (Tomasz Kusy)
    • bug #44416 Make http requests synchronous when reading the Loco API (Kocal)
    • bug #44187 Fix idempotency of LocoProvider write method (welcoMattic)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.1(Dec 9, 2021)

    Changelog (https://github.com/symfony/translation/compare/v6.0.0...v6.0.1)

    • bug #44494 Remove FQCN type hints on properties (fabpot)
    • bug #44350 Fix TranslationTrait (Tomasz Kusy)
    • bug #44416 Make http requests synchronous when reading the Loco API (Kocal)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.1(Dec 9, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.4.0...v5.4.1)

    • bug #44350 Fix TranslationTrait (Tomasz Kusy)
    • bug #44416 Make http requests synchronous when reading the Loco API (Kocal)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0(Nov 29, 2021)

    Changelog (https://github.com/symfony/translation/compare/v6.0.0-RC1...v6.0.0)

    • bug #44187 Fix idempotency of LocoProvider write method (welcoMattic)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.0(Nov 29, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.4.0-RC1...v5.4.0)

    • bug #44187 Fix idempotency of LocoProvider write method (welcoMattic)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0-RC1(Nov 24, 2021)

  • v5.4.0-RC1(Nov 24, 2021)

  • v5.3.11(Nov 22, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.10...v5.3.11)

    • bug #43990 Generate id parameter instead of letting Loco do it (welcoMattic)
    • bug #42361 correctly handle intl domains with TargetOperation (acran)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.34(Nov 22, 2021)

    Changelog (https://github.com/symfony/translation/compare/v4.4.33...v4.4.34)

    • bug #42361 correctly handle intl domains with TargetOperation (acran)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0-BETA2(Nov 14, 2021)

    Changelog (https://github.com/symfony/translation/compare/v6.0.0-BETA1...v6.0.0-BETA2)

    • bug #43967 Fix Loco Provider ID and pull & push local messages reading (welcoMattic)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.0-BETA2(Nov 14, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.4.0-BETA1...v5.4.0-BETA2)

    • bug #43967 Fix Loco Provider ID and pull & push local messages reading (welcoMattic)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0-BETA1(Nov 5, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.10...v6.0.0-BETA1)

    • feature #43758 Rename translation:update to translation:extract (welcoMattic)
    • feature #43672 Add completion feature on translation pull and push commands (welcoMattic)
    • feature #43680 Add suggestions for the option 'format' of lints commands: twig, yaml and xliff (makraz)
    • feature #42957 remove @experimental flag (nicolas-grekas)
    • feature #41858 Translate translatable parameters (kylekatarnls)
    • feature #39828 XliffLintCommand supports Github Actions annotations (YaFou)
    • feature #42088 add return types and bump to v3 (nicolas-grekas)
    • feature #41851 Add TesterTrait::assertCommandIsSuccessful() helper (yoannrenard)
    • feature #41282 Bump Symfony 6 to PHP 8 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.0-BETA1(Nov 5, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.10...v5.4.0-BETA1)

    • feature #43758 Rename translation:update to translation:extract (welcoMattic)
    • feature #43672 Add completion feature on translation pull and push commands (welcoMattic)
    • feature #43680 Add suggestions for the option 'format' of lints commands: twig, yaml and xliff (makraz)
    • feature #42957 remove @experimental flag (nicolas-grekas)
    • feature #41858 Translate translatable parameters (kylekatarnls)
    • feature #39828 XliffLintCommand supports Github Actions annotations (YaFou)
    • feature #41851 Add TesterTrait::assertCommandIsSuccessful() helper (yoannrenard)
    Source code(tar.gz)
    Source code(zip)
  • v5.3.10(Oct 29, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.9...v5.3.10)

    • bug #43364 Use symfony default locale when pulling translations from providers (Yoann MOROCUTTI)
    • bug #43312 do not export empty strings (taranovegor)
    Source code(tar.gz)
    Source code(zip)
  • v5.3.9(Sep 28, 2021)

  • v5.3.7(Aug 30, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.6...v5.3.7)

    • bug #42576 Reverse fallback locales (ro0NL)
    • bug #42649 Fix message key handling for the Localise provider (xepozz)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.30(Aug 30, 2021)

  • v5.3.4(Jul 26, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.3...v5.3.4)

    • bug #41504 Fix default value for locales in translation push|pull commands (welcoMattic)
    • bug #42243 Fix base_uri (welcoMattic, Nyholm)
    • bug #42174 Indicate compatibility with psr/log 2 and 3 (derrabus)
    • bug #42130 fix fallback to Locale::getDefault() (nicolas-grekas)
    • bug #42068 Add a Special Case for Translating Choices in en_US_POSIX (chrisguitarguy)
    • bug #40529 Missing translations from traits (insekticid)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.27(Jul 26, 2021)

    Changelog (https://github.com/symfony/translation/compare/v4.4.26...v4.4.27)

    • bug #42174 Indicate compatibility with psr/log 2 and 3 (derrabus)
    • bug #42130 fix fallback to Locale::getDefault() (nicolas-grekas)
    • bug #42068 Add a Special Case for Translating Choices in en_US_POSIX (chrisguitarguy)
    • bug #40529 Missing translations from traits (insekticid)
    Source code(tar.gz)
    Source code(zip)
  • v5.2.12(Jul 26, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.2.11...v5.2.12)

    • bug #42174 Indicate compatibility with psr/log 2 and 3 (derrabus)
    • bug #42130 fix fallback to Locale::getDefault() (nicolas-grekas)
    • bug #42068 Add a Special Case for Translating Choices in en_US_POSIX (chrisguitarguy)
    • bug #40529 Missing translations from traits (insekticid)
    Source code(tar.gz)
    Source code(zip)
  • v5.3.3(Jun 30, 2021)

  • v5.2.11(Jun 30, 2021)

  • v4.4.26(Jun 30, 2021)

  • v5.3.2(Jun 17, 2021)

  • v5.2.10(Jun 1, 2021)

  • v4.4.25(Jun 1, 2021)

  • v5.3.0(May 31, 2021)

  • v5.3.0-RC1(May 19, 2021)

    Changelog (https://github.com/symfony/translation/compare/v5.3.0-BETA4...v5.3.0-RC1)

    • bug #41240 Fixed deprecation warnings about passing null as parameter (derrabus)
    Source code(tar.gz)
    Source code(zip)
Internationalization tools, particularly message translation.

Aura.Intl The Aura.Intl package provides internationalization (I18N) tools, specifically package-oriented per-locale message translation. Installation

Aura for PHP 82 Dec 22, 2021
Provides support for message translation and localization for dates and numbers.

The I18n library provides a I18n service locator that can be used for setting the current locale, building translation bundles and translating messages. Additionally, it provides the Time and Number classes which can be used to output dates, currencies and any numbers in the right format for the specified locale.

CakePHP 24 Oct 2, 2021
A GUI for managing JSON translation files in your laravel projects.

Laravel Language Manager Langman is a GUI for managing your JSON language files in a Laravel project. Installation Begin by installing the package thr

Mohamed Said 515 Dec 19, 2021
Better translation management for Laravel

Better localization management for Laravel Introduction Keeping a project's translations properly updated is cumbersome. Usually translators do not ha

Waavi 344 Dec 14, 2021
[virion] Language management library for automatic translation

libtranslator :: library for automatic translation ✔️ Multilingual support for plugin messages ✔️ Translation language is set according to the player

PocketMine-MP projects of PresentKim 1 Oct 23, 2021
Laravel translation made __('simple').

Translation.io client for Laravel 5.5+/6/7/8 Add this package to localize your Laravel application. Use the official Laravel syntax (with PHP or JSON

Translation.io 67 Jan 8, 2022
🎌 Laravel Localization Helper :: Easily add translation variables from Blade templates.

LocalizationHelper Package for convenient work with Laravel's localization features and fast language files generation. Take a look at contributing.md

Awes.io 37 Jan 15, 2022
Manage Laravel translation files

Laravel 5 Translation Manager For Laravel 4, please use the 0.1 branch! This is a package to manage Laravel translation files. It does not replace the

Barry vd. Heuvel 1.4k Jan 9, 2022
A Gui To Manage Laravel Translation Files

Lingo A file based translation manager, which unlike other Lang managers don't need a database connection to handle the translation. Installation comp

Muah 93 Dec 21, 2021
75 languages support for Laravel 5 application based on Laravel-Lang/lang.

Laravel-lang 75 languages support for Laravel 5 application based on Laravel-Lang/lang. Features Laravel 5+ && Lumen support. Translations Publisher.

安正超 1.2k Jan 7, 2022
Language files manager in your artisan console.

Laravel Langman Langman is a language files manager in your artisan console, it helps you search, update, add, and remove translation lines with ease.

Mohamed Said 848 Jan 4, 2022
Automatically translate and review your content via Lokalise

This extension will work as a bridge between Pimcore and Lokalise for the purpose of automating the whole translation workflow. Thus eliminating most of the manual steps in the task along with availing quality translation-review service from Lokalise.

Pravin chaudhary 6 Jan 10, 2022
Weblate translation provider for Symfony Translation.

Weblate Translation Provider This bundle provides a Weblate integration for Symfony Translation. Installation composer require m2mtech/weblate-transla

Martin Mandl 1 Jan 16, 2022
DooTask is a lightweight open source online project task management tool that provides various document collaboration tools, online mind mapping, online flowcharting, project management, task distribution, instant IM, file management and other tools.

DooTask is a lightweight open source online project task management tool that provides various document collaboration tools, online mind mapping, online flowcharting, project management, task distribution, instant IM, file management and other tools.

kuaifan 1.4k Jan 21, 2022
The Templating component provides all the tools needed to build any kind of template system.

Templating Component The Templating component provides all the tools needed to build any kind of template system. It provides an infrastructure to loa

Symfony 984 Jan 10, 2022
Debug - The Debug component provides tools to ease debugging PHP code.

Debug Component CAUTION: this component is deprecated since Symfony 4.4. Instead, use the ErrorHandler component. The Debug component provides tools t

Symfony 7.3k Jan 11, 2022
Internationalization tools, particularly message translation.

Aura.Intl The Aura.Intl package provides internationalization (I18N) tools, specifically package-oriented per-locale message translation. Installation

Aura for PHP 82 Dec 22, 2021
The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump() function that you can use instead of var_dump().

VarDumper Component The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump() function t

Symfony 6.8k Jan 15, 2022
The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump() function that you can use instead of var_dump().

VarDumper Component The VarDumper component provides mechanisms for walking through any arbitrary PHP variable. It provides a better dump() function t

Symfony 6.8k Jan 16, 2022
Clockwork - php dev tools in your browser - server-side component

Clockwork is a development tool for PHP available right in your browser. Clockwork gives you an insight into your application runtime - including requ

its 4.2k Jan 16, 2022
Provides support for message translation and localization for dates and numbers.

The I18n library provides a I18n service locator that can be used for setting the current locale, building translation bundles and translating messages. Additionally, it provides the Time and Number classes which can be used to output dates, currencies and any numbers in the right format for the specified locale.

CakePHP 24 Oct 2, 2021
This package provides new helper functions that take care of handling all the translation hassle and do it for you.

Laravel Translate Message ?? This package provides new helper functions that take care of handling all the translation hassle and do it for you. Insta

Basel Rabia 1 Jan 7, 2022
A powerful command line application framework for PHP. It's an extensible, flexible component, You can build your command-based application in seconds!

CLIFramework CLIFramework is a command-line application framework, for building flexiable, simple command-line applications. Commands and Subcommands

Yo-An Lin 412 Dec 9, 2021
This bundle provides tools to build a complete GraphQL server in your Symfony App.

OverblogGraphQLBundle This Symfony bundle provides integration of GraphQL using webonyx/graphql-php and GraphQL Relay. It also supports: batching with

Webedia - Overblog 681 Jan 16, 2022
The Cache component provides an extended PSR-6 implementation for adding cache to your applications.

Symfony PSR-6 implementation for caching The Cache component provides an extended PSR-6 implementation for adding cache to your applications. It is de

Symfony 3.6k Jan 10, 2022
A GUI for managing JSON translation files in your laravel projects.

Laravel Language Manager Langman is a GUI for managing your JSON language files in a Laravel project. Installation Begin by installing the package thr

Mohamed Said 515 Dec 19, 2021
Allows to connect your `Laravel` Framework translation files with `Vue`.

Laravel Vue i18n laravel-vue-i18n is a Vue3 plugin that allows to connect your Laravel Framework JSON translation files with Vue. It uses the same log

Francisco Madeira 135 Jan 19, 2022