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

Comments
  • Fix: translation:push command diff using intl-icu

    Fix: translation:push command diff using intl-icu

    Provider translations do not come back with "+intl-icu" in $provider->read($domains, $locales);, so local translations should not include it for the diff.

    opened by Broutard 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
  • Update TranslatorInterface.php setLocale()

    Update TranslatorInterface.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: Add typing 'string' in C:\Bitnami\server\apps\gateway-link-api\vendor\symfony\translation\TranslatorInterface::setLocale(string $locale);

    opened by ghost 1
  • 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
  • Process multiple segments within a single unit.

    Process multiple segments within a single unit.

    Xliff 2.0 supports multiple segments within a single unit, but the loader was only processing the first segment. The loader will now correctly process all segments within a unit.

    opened by timewasted 1
  • Consider the numeric messages as same as fallback

    Consider the numeric messages as same as fallback

    It does not make sense to warn the user because "2015" or "10" are not translated. Maybe numeric values should not be counted at all

    opened by gregquat 1
Releases(v6.2.3)
  • v6.2.3(Dec 28, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.2.2...v6.2.3)

    • bug #48774 Fix undefined variable messages in ConstraintVisitor (alamirault)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.2(Dec 16, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.2.1...v6.2.2)

    • bug #48451 Fix extraction when dealing with VariadicPlaceholder parameters (Kocal)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.0(Nov 30, 2022)

  • v6.2.0-RC1(Nov 25, 2022)

  • v6.2.0-BETA3(Nov 19, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.2.0-BETA2...v6.2.0-BETA3)

    • bug #48222 Configure replace_breaks to prevent issues with multilines translations (Kocal)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.0-BETA1(Oct 24, 2022)

  • v6.1.6(Oct 12, 2022)

  • v6.0.14(Oct 12, 2022)

  • v5.4.14(Oct 12, 2022)

  • v4.4.47(Oct 12, 2022)

  • v6.1.4(Aug 26, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.1.3...v6.1.4)

    • bug #47391 Fix push command --delete-missing options when there are no missing messages (rwionczek)
    • bug #47216 Crowdin provider throw Exception when status is 50x (alamirault)
    • bug #47172 Fix reading intl-icu domains with LocoProvider (nicolas-grekas)
    • bug #46190 Fix translator overlapse (Xavier RENAUDIN)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.12(Aug 26, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.0.11...v6.0.12)

    • bug #47391 Fix push command --delete-missing options when there are no missing messages (rwionczek)
    • bug #47216 Crowdin provider throw Exception when status is 50x (alamirault)
    • bug #46190 Fix translator overlapse (Xavier RENAUDIN)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.12(Aug 26, 2022)

    Changelog (https://github.com/symfony/translation/compare/v5.4.11...v5.4.12)

    • bug #47391 Fix push command --delete-missing options when there are no missing messages (rwionczek)
    • bug #47216 Crowdin provider throw Exception when status is 50x (alamirault)
    • bug #46190 Fix translator overlapse (Xavier RENAUDIN)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.45(Aug 26, 2022)

  • v6.1.3(Jul 29, 2022)

  • v6.0.11(Jul 29, 2022)

  • v5.4.11(Jul 29, 2022)

  • v4.4.44(Jul 29, 2022)

  • v6.1.0(May 27, 2022)

  • v6.0.9(May 27, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.0.8...v6.0.9)

    • bug #46239 Refresh local translations on PushCommand if the provider has domains (Florian-B)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.9(May 27, 2022)

    Changelog (https://github.com/symfony/translation/compare/v5.4.8...v5.4.9)

    • bug #46239 Refresh local translations on PushCommand if the provider has domains (Florian-B)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0-RC1(May 14, 2022)

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

    • bug #46239 Refresh local translations on PushCommand if the provider has domains (Florian-B)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0-BETA2(Apr 27, 2022)

  • v6.0.8(Apr 27, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.0.7...v6.0.8)

    • bug #45171 Allow usage of Provider domains if possible (welcoMattic)
    • bug #45968 Update the ICU data to 71.1 - 4.4 (jderusse)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.8(Apr 27, 2022)

    Changelog (https://github.com/symfony/translation/compare/v5.4.7...v5.4.8)

    • bug #45171 Allow usage of Provider domains if possible (welcoMattic)
    • bug #45968 Update the ICU data to 71.1 - 4.4 (jderusse)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.41(Apr 27, 2022)

  • v6.1.0-BETA1(Apr 15, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.0.7...v6.1.0-BETA1)

    • feature #46045 Improve LocaleSwitcher a bit (nicolas-grekas)
    • feature #45793 add LocaleSwitcher service (kbond)
    • feature #45377 Bump minimum version of PHP to 8.1 (nicolas-grekas)
    • feature #45421 Add the possibilty to export xliff translation with the .xliff suffix (DanielBadura)
    • feature #44484 Send If-Modified-Since header when possible (Kocal)
    • feature #44672 Translatable parameters (sylfabre)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.7(Apr 2, 2022)

    Changelog (https://github.com/symfony/translation/compare/v6.0.6...v6.0.7)

    • bug #45840 Fix locales format in CrowdinProvider (ossinkine)
    • bug #45839 Fix intersect in TranslatorBag (ossinkine)
    • bug #45791 Add content-type for POST translations (Tomasz Kusy)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.7(Apr 2, 2022)

    Changelog (https://github.com/symfony/translation/compare/v5.4.6...v5.4.7)

    • bug #45840 Fix locales format in CrowdinProvider (ossinkine)
    • bug #45839 Fix intersect in TranslatorBag (ossinkine)
    • bug #45791 Add content-type for POST translations (Tomasz Kusy)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.6(Mar 5, 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 86 Dec 18, 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 26 Oct 22, 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 Nov 30, 2022
Filament Translations - Manage your translation with DB and cache

Filament Translations Manage your translation with DB and cache, you can scan your languages tags like trans(), __(), and get the string inside and tr

Fady Mondy 32 Nov 28, 2022
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 354 Dec 18, 2022
[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 5 Jul 29, 2022
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 109 Dec 29, 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 36 Jul 18, 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.5k Jan 4, 2023
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 97 Dec 5, 2022
Official PHP library for the DeepL language translation API.

deepl-php Official PHP client library for the DeepL API. The DeepL API is a language translation API that allows other computer programs to send texts

DeepL 78 Dec 23, 2022
French-Traduction-Pterodactyl est la traduction française de pterodactyl French-Traduction-Pterodactyl is the French translation of pterodactyl

French-Traduction-Pterodactyl Star French-Traduction-Pterodactyl est la traduction française de pterodactyl French-Traduction-Pterodactyl is the Frenc

null 5 Sep 26, 2022
Translation (i18n) Manager as a virion

TL Translation (i18n) Manager as a virion Translation use hook-like $t = $tl->useTranslation($player->getLocale()); $player->sendMessage($t("message-k

RedMC Network 3 Oct 28, 2022
Composer package providing translation features for PHP apps

PHP translation This is a composer package providing translation support for PHP applications. It is similar to gettext, in usage, with these differen

Sérgio Carvalho 0 Aug 15, 2022
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.3k Jan 4, 2023
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 867 Nov 30, 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
Generates a vue-i18n compatible include file from your Laravel translations

This is fork of martinlindhe/laravel-vue-i18n-generator to give Laravel 8+ support for this excellent package.

Alefe Souza 1 Nov 11, 2021
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 8 Sep 20, 2022