Opencart language install

In this Opencart tutorial, we will show you easy localization, how to make the language pack in OpenCart 3. We will use “Nepalese” or “Nepali” as new language as there is no language pack for Nepali. Once we created the language pack then we will add and activate in the OpenCart.

Time needed: 1 hour.

Localization or globalization is done by making the Opencart language pack. Here are the steps to make the language pack:

  1. Create a language folder in admin/ folder

    Go to admin/language then copy en-gb/ folder and paste it and change the folder name to your language name.
    In our example, we name it “npl”.

  2. Change the flag and main language name file

    Find the flag for your language, preferable transparent png with 16*16 size. Go to admin/language/npl and then place there with the same name as code. In Nepali, it is “npl” so we make it npl.png
    Change the filename admin/language/npl/en-gb.php to admin/language/npl/npl.php

  3. Change code name to your language

    Find your language code, for Nepali, it is “npl”, now open admin/language/npl/npl.php, and change Locale code. Like:

    $_[‘code’] = ‘npl’;

    Change other as per your language like direction, date format short, date format long, time format, decimal point, thousand points.

  4. Now start adding your language text

    Open each and every ***.php and change English text to your language text except the variable in $_[‘DONTCHANGE’]. For example, if you open admin/language/npl/npl.php then you need to change the

    $_[‘text_yes’] = ‘Yes’;
    to
    $_[‘text_yes’] = ‘हुन्छ’;

    Just change values after equal to sign. Do the same for all of the others then your admin language is ready to install.

    Opencart language pack

  5. Similarly, we need to do the same thing in catalog/ folder, so the first step, create a language folder in the catalog/language folder

    Go to catalog/language then copy the en-gb and paste it and change the name to your language.
    In our example, we name it “npl”.

  6. Change the filename to language name and flag name to language name in catalog/ folder

    Go to catalog/language/npl and add the flag related to the country and name it as per the language code. In our example, we named it npl.png. Previously in Opencart 2.0, they had collections of flags, but now they removed in 3.0, if you still need lists of small flags collection then you can download from download small flags.
    Then, rename the en-gb.php to npl.php

  7. Replace code name to your language in catalog/ folder also

    Open catalog/language/npl/npl.php and change $_[‘code’]= ‘en’; to

    $_[‘code’] = ‘npl’;

    Similarly if needed change other Locale as per language needs.

  8. Start changing English text to your language text in catalog/language/npl folder

    Open each and every ***.php and change English text to your language text except the variable in $_[‘DONTCHANGE’]. For example, if you open catalog/language/npl/npl.php then you need to change the

    $_[‘text_yes’] = ‘Yes’;
    to
    $_[‘text_yes’] = ‘हुन्छ’;

    Create Opencart language pack

  9. Now make a ***.ocmod.zip

    Create upload/ folder and add the admin/ and catalog/ folder and inside the admin/ folder create language/ folder and then copy the translated folder. Here we copy the npl/ folder. Then, make zip and name ****.ocmod.zip. Your extension is ready to add.
    Language pack folder structure

How to add the language in Opencart?

  • Go to Extensions >> Installer and upload the ***.ocmod.zip
  • Go to Extensions >> Modifications and Refresh it
  • Go to System >> Localisation >> Languages
  • Then add the language, in our Nepali case it is something like below:
    How to add language in Opencart
  • Select the folder of your language at Code select box.
  • If you see “Warning: You added before the language!” then ignore for the first time and save again.
  • Your language is active.

Please don’t forget to post your questions or comments so that we can add extra topics, free module or opencart tutorial that we need to develop which helps to develop quality. You can follow at twitter account rupaknpl and subscribe YouTube user opencart tutorial. Thanks a lot.

LEAVE A REPLY

Please enter your comment!
Please enter your name here