In this tutorial, you will learn how to translate modifications.
Sometimes translations (language constants) in OpenCart are located in the modifications, not in the language files. It means that it is required to edit XML files to apply the translation. All the modifications are located in the theme/themexxx-extensions.zip file.
For example, let’s translate the pagination, which you see while viewing the catalog: Next>, End>>, <Prev, <<Start. Those are located in the TemplateMonster_pagination.ocmod.xml file.
- As you remember, all your modifications are located in the theme/themename-extensions.zip file. So, make sure to uncompress the archive first, to find the install.xml file inside.
- Open this file and locate the following line of code:
- You can see that this is the translation for the en-gb locale. This means that the changes will be applied to the English version of the site. Simply change the text within the quotes (on right).
- In order to add a translation for a different language, for example, Russian, you need to check the name of localization folder inside the catalog/languages folder. Usually, for the Russian localization, it is named ru-ru.
- Add the following code right after the previous one (just copy-paste the block of code), change the en-gb to your localization folder name (in our case it is ru-ru) and specify the translations.
- After it is done, go to your OpenCart admin panel, navigate to Extensions->Modifications and delete the modified extension, in our case it is TemplateMonster Pagination.
- Next, go to the Extensions > (Extension) Installer and run the installation of modified modification.
- Get back to Extensions > Modifications and refresh them, by clicking ‘refresh’ button in the top right corner.