How to add new languages to your OpenCart extensions? A 4-step tutorial

If you are an OpenCart administrator, you have probably noticed that most OpenCart extensions are sold only with support for the English language. If you want to translate your extensions into a different language, just follow the steps in this blog post.

In this tutorial we will assume that you need to install an extension for the Spanish language. As an example, we will be using the module FacebookLogin by iSenseLabs.

This tutorial also applies to OpenCart themes.

Without further ado, let’s jump in!

 

Prerequisites

Before we begin, you must make sure that you have met the following conditions:

  1. This tutorial applies for new or modified installations of OpenCart 1.5.x or OpenCart 2.x
  2. Make sure you have the installation .ZIP of the extension which you need to translate
  3. Make sure that the target language is already installed in your OpenCart system
  4. (Optional) Basic understanding of HTML

 

What to do

Step 1 (Preparation)

First, extract your extension installation .ZIP in a new folder. In most cases you will receive a folder structure, similar to the following:

Note: Notice that in OpenCart 2.x the extension .ZIP contains another .ZIP extensionname.ocmod.zip. For our example we will need to extract this .ZIP as well.

 

Step 2 (Renaming)

The folders in which we are interested are:

  • upload/admin/language/english
  • upload/catalog/language/english

Important: We are about to rename the above 2 folders. To set the proper new name of the folders, please navigate to your OpenCart admin panel > System > Localisation > Languages > [Your Language, e.g. Spanish] > Edit and find the value of the Directory field. In our example this will be “spanish”.

Rename both of these folders to the language of your choice. The result should look something like this:

Great job! Let’s move along.

 

Step 3 (Translating)

From the previous step you should now have the following folders:

  • upload/admin/language/spanish
  • upload/catalog/language/spanish

Now comes the tricky part. You should access every file in these two folders and translate the English text to your preference. A single English language entry looks like this:

$_['text_column_left'] = 'Column Left';

The translation of this entry would look like this:

$_['text_column_left'] = 'Columna Izquierda';

Make sure to do this translation for each entry you encounter.

Note: Some language entries contain special HTML or wildcard characters like <strong>http://</strong>, %s, <b></b> and others. Make sure to keep these special words unchanged and translate only the text within these entries.

 

Step 4 (Uploading)

We are almost done. What you need to do now is to upload your new folders in your OpenCart installation, making sure to preserve the folder locations.

Note: If you have renamed your admin folder, make sure to upload the new language in your modified admin folder.

  • upload/admin/language/spanish -> /<opencart-root>/<your-admin-folder>/language/spanish
  • upload/catalog/language/spanish -> /<opencart-root>/catalog/language/spanish

​​

In conclusion

Voila! You have now translated your OpenCart extension. I hope you found this tutorial useful. If you have any questions or comments, we welcome your feedback in the comments section below.

 

Join 11,000+ subscribers receiving actionable E-commerce advice

* Unsubscribe any time
comments powered by Disqus