After doing development of so many modules for opencart, I realised an issue that so many our clients faced specially those, who don’t use the English language as store’s default language.
We’ll be using Spanish language pack for example which you can download from here.
Download the zip and unzip it and then upload files to opencart setup. Next step is adding new language, for this go to system->localization->languages and click on add new button. You’ll get below page to fill details about language that you are about to add.
To fill above form, every language pack provider provide details like below.
Opencart Company ? Read More
Fill these details in the above screenshot form as below.
And now just save it and you’ll see in the languages list as below.
As you can see that as of now default language is still english, that you have change from system->setting under the local tab, there is an option of language option, change it to spanish and default language will become spanish for store.
The next major issue is, how to translate a module that is built on the multi language paradigm. If module is following language pattern for any module then it must have language files.
If the module has language files for English and you want to translate them for Spanish, then at the very first copy all the language files from English language directory and paste all of them in Spanish directory in the same structure as it was in English language.
For example, there is a file in module directory for English language called foo.php then copy this into the module directory of Spanish language.
Suppose Enlish file has these keyword to be translated as below screenshot.
Then these will be translated to Spanish as below.
After doing above changes, when you’ll change the language from front end then, page will be translated in to Spanish language only for those keywords that exists in language file only.