Articles on: Tips & Tricks

Adding a new translation language

If you need to add new language to the application, you will need to create your own language files.

Please create a copy of the English (en) language files:

\language\core-en.po
\language\core-en.mo


Then, rename them accordingly to your new language. If you review the file \library\Zend\Locale\Data\Translation.php and search your new language on the array $languageTranslation you will find a code for the language, for example: 'Serbian' => 'sr' so you need to rename the new files using the code of the new language, for example:

\language\core-sr.po
\language\core-sr.mo

Now, it is time to start the translations. You will need to open the files \language\core-sr.po and language\javascript-sr.po, and add your translations there. You can use a free editor like Poedit.

Any time you change the file \language\core-sr.po, you need to convert it to \language\core-sr.mo, which is the binary file that Clientexec uses to load translations. If you are using Poedit you can easily generate the .mo file from there. If you are not using Poedit then we have made a tutorial video on how to generate a .mo file: https://www.screencast.com/t/h2zAKFcKi

The video just shows the following:

Opening a language file to add translations or modifying an existing one. In the video, the file edited is for the Spanish language \language\core-es.po but for the example it should be \language\core-sr.po
After adding your changes to the file, then the video shows a web site (https://localise.biz) that you can open, then at the bottom of the site there is a menu where you can select "Language pack converter" (https://localise.biz/free/converter), select your edited language file, configure what you will generate, in this case, you select the "Source language" and the format for the file (In the example: Serbian, and .MO file [To: > Gettext > Gettext MO (binary)]), and then you convert the file on the site and save the new file.
Then you need to rename the new file consistently with the one you used, so for the example you need it to be renamed to core-sr.mo
Then, you will need to place the file on the proper location \language\core-sr.mo
Finally, make sure the file has read permissions, and you are done.

Updated on: 15/08/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!