Learn how to create language translation for our Joomla extensions.
As an example, we are going to use the DJ-Suggester component Russian language pack and translate it to Portuguese-Brasil, by providing some changes in the language file.
The Language Pack zip file structure
The best way to create your own language pack is to use/edit one of the existing language packs for chosen Joomla extension.
Let’s use the DJ-Suggester Russian language pack as an example here.
As you can the package name [“ru-RU-djsuggester”] shows that the default language is Russian.
The Joomla language packs follow a standard language naming: [xx-XX] with the use of country codes.
"ru-RU" in the package name works for the Russian language.
In the next step, we are going to create a translation for Portuguese-Brasil, our language tag would be "pt-BR".
It is just an example. Remember that you should use the appropriate language tag for your translation.
Download the language pack and extract the downloaded zip file.
For this example, you should get the following file structure,
- Administrator (directory)
- ru-RU-djsuggester.xml (file)
Open the Administrator directory. The following structure used there is:
All “ru-RU” names should be replaced with “pt-BR”. It concerns the zip package name, file names and the content used inside the ru-RU-djsuggester.xml file.
Let’s edit the ru-RU-djsuggester.xml
Open install.xml in your favorite Text editor.
Search for "ru-RU" in the whole document and replace them as "pt-BR".
Edit the <description/> tag as "DJ-Suggester Portuguese-Brasil Language Pack"
You can also change the:
That's it. Save the file.
Now, open the "administrator" folder and rename "ru-RU" to "pt-BR" in all filenames.
Each .ini file should be saved as UTF-8 without BOM encoding.
As you can see below, each line from the file consists of a pair of strings separated by an equals sign:
- PLG_DJSUGGESTER_BASIC_SETTINGS="Основные настройки"
- “PLG_DJSUGGESTER_BASIC_SETTINGS=” is an original string here and the "Основные настройки" part is the translated string.
You need to replace the string after the (=) sign in to your language string. For example:
- PLG_DJSUGGESTER_BASIC_SETTINGS="Your Portuguese-Brasil String".
Because as an example we use the Russian language and it is probably incomprehensible to you, you must know that the translated phrase in Russian is a translation from the fragment: “BASIC_SETTINGS”. You can use the English .ini files for the translations. These files are delivered with the original component zip file package (you can not download the English language pack separately.)
You need to follow the same instructions in all .ini files. Often the structure is more extended and it contains “Administrator” and “Site” Folders (instead of administrator folder only).
Finally, compress the package into ZIP file called with the same name as before but with replaced “ru-RU” into “pt-BR”. In this example, our package name was: “ru-RU-djsuggester”
So you need to change into “pt-BR-djsuggester”
Now the translation is ready and you can install it using the Joomla! Installation procedure.
Congratulations! You have successfully translated the component to your language.