New in Symfony 5.3: Translation Providers

Contributed by Mathieu Santostefano in #38475.

The process of translating Symfony applications requires extracting all translatable contents from templates and code. This task is boring and error-prone; that’s why Symfony provides a translation:update command to extract contents and update catalogs automatically. This works great, unless your application uses external translation services with their own local or SaaS-based translation tools. Then you need to send them the translation catalogs from time to time to translate the new contents and then merge the returned catalog back into your application. In Symfony 5.3 we’ve improved this workflow thanks to the integration of external translation providers. You can now upload/download translations to services like Crowdin, Loco, Lokalise and PoEditor and merge the new translations automatically into your application. Let’s imagine that you hire a translation company that uses Crowdin to share their work with you. First, configure the access to this provider: 1 2 3 4 5 6 7 8# config/packages/translation.yaml framework: translator: providers: crowdin: dsn: 'crowdin://PROJECT_ID:API_TOKEN@ORGANIZATION_DOMAIN.default' domains: ['messages'] locales: ['en', 'ja']

Now you can upload the current application translations with this command: 1 2 3 4 5 6 7 8# upload all translations for all locales $ php bin/console translation:push crowdin --force

or upload translations only for some locale(s)

$ php bin/console translation:push crowdin --locales ja

or just upload the translations of a particular domain

$ php bin/console translation:push crowdin --domain admin

Similarly, you can download the translations from the external service and let Symfony merge them automatically with the existing translations: 1 2 3 4 5 6# download all translations for all locales $ php bin/console translation:pull crowdin --force

download all translations for 'ja' locale and add the new

translations into the existing file

$ php bin/console translation:pull crowdin --locales ja

Both commands define more flags and options. Run them with the --help option to learn about those options.

                Sponsor the Symfony project.

http://feedproxy.google.com/~r/symfony/blog/~3/t9dIHT2SYpw/new-in-symfony-5-3-translation-providers

Établi 4y | 21 mai 2021 à 07:21:48


Connectez-vous pour ajouter un commentaire

Autres messages de ce groupe

SymfonyLive Berlin 2025: Need a MACH-ready Search Engine?

SymfonyLive Berlin 2025, conference held in English, will take place from April 1 to 4! The schedule is being revealed gradually. More details are available here.

As we are now unveiling th

24 janv. 2025 à 11:20:16 | Symfony
SymfonyLive Paris 2025 : Rôles & permissions : développez une marque blanche avec du Feature Flipping

SymfonyLive Paris 2025, conference in French language only, will take place from March 27 to 28! The schedule is currently being revealed as we go along. More details are available here.

Al

23 janv. 2025 à 16:50:03 | Symfony
SymfonyLive Berlin 2025: So you think you know PHPUnit

SymfonyLive Berlin 2025, conference held in English, will take place from April 1 to 4! The schedule is being revealed gradually. More details are available here.

First, a big thank you to

22 janv. 2025 à 08:20:10 | Symfony
SymfonyLive Paris 2025 : Passkeys pour une authentification fluide et sécurisée

SymfonyLive Paris 2025, conference in French language only, will take place from March 27 to 28! The schedule is currently being revealed as we go along. More details are available here.

To

21 janv. 2025 à 11:30:10 | Symfony
Join us for SymfonyDay Chicago – March 17, 2025!

Mark your calendars for March 17, 2025 because SymfonyDay Chicago 2025 promises to be a one-of-a-kind event that you won’t want to miss! This full day is dedicated to celebrating the incredible contri

20 janv. 2025 à 19:20:03 | Symfony
A Week of Symfony #942 (13-19 January 2025)

This week, Symfony celebrated the SymfonyOnline January 2025 conference. In addition, it announced the new Symfony UX Core Team. Lastly, the upcoming Symfony 7.3 version simplified the configuration o

19 janv. 2025 à 08:30:08 | Symfony
Announcing the Symfony UX Core Team

The Symfony UX initiative was announced in December 2020. It was introduced to enhance the developer experience by integrating JavaScript tools and libraries more seamlessly with Symfony applications,

13 janv. 2025 à 15:40:04 | Symfony