Hugo Soltys
Hugo Soltys

My name is Hugo, I'm 27 and I'm a Symfony developer since 2013. I love to create websites by myself to learn new technologies or increase my skills.

M6 Web
2018-10-16 - Today Symfony developer
Decathlon
2016-01-01 - 2018-10-15 Symfony developer
IT Room
2014-09-01 - 2015-12-31 Symfony developer
Noogaa
2013-09-01 - 2014-08-31 Student symfony developer
Work with me

Easily translate your Symfony app through a simple user interface

October 25, 2019 by Hugo - 495 views - 0 Comments


Easily translate your Symfony app through a simple user interface

Translating your app in different languages can be time-consuming and boring. That's why I developed a simple UI to help you because I know that feel, bro.


Why this POC ?

In many Symfony projects, you have to support multiple languages for your users.

In most of the case, you have a default locale in which you work 90% of the time but there comes a time when you have to translate all your translation keys in all the supported languages of your application.

You know the stuggles of this. A deployment is required each time your Product Owner wants to change Validate by Submit or when you have to deploy a hotfix because you thought that Green was writed Verre in French.

That's why I developed this POC. It provides a simple UI allowing a competent user to translate the app by himself.

 

How it works

All the translations are listed in a table filterable by translation domain and/or locale.

For each translation, you can see the key, the text translated in the default locale and an input in which you just have to type the translated message in the chosen locale.

On the blur of the input, the typed translation will be saved in the corresponding file. (e.g. : if you translate the word Red of the colors domain in French, the translated message will be written in your colors.fr.yml file).

If the corresponding file does not exists, it will be created in the directory provided by your %translator.default_path% parameter.

If you want to support more locales, just add them to the supported_locales parameters of your config/services.yaml file.

The default locale is the one chosen in the config/packages/translation.yaml.

 

Try it !

All the code is available on my GitHub. Just clone it and run composer install and symfony server:start

Check this link to install Symfony Server.

 

I hope this will save you some time !