You might find yourself with the happy problem of having users from other countries requesting you to translate your OpenCart site so that they can buy more stuff from you. Here’s a quick and dirty guide on how to get it done using Google Translate and language extension and address some of the issues you may run into. This article assumes you have some basic knowledge of OpenCart, and for this example, we’ll be adding Simplified Chinese. Before making any changes to OpenCart, it’s best to backup your data and ideally to make changes in a backup test site before rolling out to a test site.
First option: Install Google Translate
A really quick way to provide translation in your website is to install the Google Translate extension, which gives the user an option of translating the website to 90+ languages.
Pros: Very quick and easy to install extension. No manual translation of site required. 90+ languages supported.
Cons: Translation relies on Google completely, which may not be as accurate or sensible as manual translation.
This extension can be installed and customised easily. More advanced customisation can be done at the Google Translate site, whereby you can shorten the dropdown list, track translation traffic, etc.
After you customise the plugin, replace the original code found in catalog\view\theme\default\template\module\gtranslate.tpl (make sure to make a backup of the original file).
Second option: Download and install language extension
The “standard” way is to download and install the required language extension.
a. Go to OpenCart Extensions site
b. Search for the required language and fill in the correct filter: Categories, License type (all, free, or commercial) and OpenCart version.
c. Select and download extension. If you are not sure which extension to use, you can shortlist by looking at the average rating, number of comments, date last modified, and support provided (look at “Comments” tab” in the extension or support forum). For this example, we will pick Simplified Chinese Language Pack.
d. Install extension according to the instructions (normally very straight-forward for languages)
e. You should see the language selection buttons, such as below:
f. All menus, pages, and products will then have a new entry you can fill in for the newly added language. Depending on the number of products in your site, this could result in a lot of work. See next section for suggestions on how to reduce your workload.
You may encounter an error such as
PHP Notice: Undefined offset: 3 in /home/.../admin/view/template/module/tfc.tpl on line 175
In this example tfc.tpl is referring to the template used. To fix this error, go to OpenCart Admin-Extensions-Modules-Theme/Template Settings-Edit and look through the entries for the newly added language and ensure that there are no errors there. If you find an error message, in the entry, simply delete it or replace with the correct translation. This should resolve the “undefined offset” error.