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

Létrehozva 4y | 2021. máj. 21. 7:21:48


Jelentkezéshez jelentkezzen be

EGYÉB POSTS Ebben a csoportban

New Core Team Members, 2025 Edition

A few weeks ago, I had the pleasure of announcing the formation of the Symfony UX Core Team, a dedicated group working to enhance the frontend development experience within the Symfony ecosystem. Toda

2025. febr. 24. 16:20:03 | Symfony
SymfonyLive Paris 2025 : Du lego de composants pour un bundle Gotenberg !

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

2025. febr. 24. 13:50:07 | Symfony
A Week of Symfony #947 (17-23 February 2025)

This week, development activity focused on new security features. The upcoming Symfony 7.3 version added support for security voters to explain their vote, improved the IsGranted attribute to allow us

2025. febr. 23. 10:10:09 | Symfony
SymfonyLive Berlin 2025: Agentic Applications with Symfony

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.

We’re thrilled to announce

2025. febr. 21. 9:20:12 | Symfony
SymfonyLive Paris 2025 : Postgres pour vos besoins NoSQL

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

2025. febr. 20. 10:10:13 | Symfony
SymfonyLive Berlin 2025: Asynchronous PHP

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.

We’re thrilled to announce

2025. febr. 19. 8:40:05 | Symfony
SymfonyLive Paris 2025 :  Le Composant Symfony Mapper

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

2025. febr. 18. 14:10:24 | Symfony