Recommendations For Magento Stores Internationalization: Magento 1 and Magento 2 Peculiarities

If you are interested in Magento store internationalization, this article will be really useful for you. The special steps should be followed to run successfully numerous languages. These steps are presented below.


Necessary actions for realizing internationalization in Magento

To realize internationalization you should perform these necessary actions:

1. First of all, remember that various sites can be created for every language. It enables to divide the orders, catalogs, clients, patterns and domains depending on the language. Using different sites will ensure that you have the frontends that differ from each other, but one admin panel can be used for managing them.  

2. Create some store in addition to your main website. Thus your catalogue will be divided. The privilege is the ability of selling various goods for various regions by means of the one site with the joint databases with information about clients and orders.

3. Make a new view of your store. For example, the templates based on different languages can be divided, and the text translated in blocks or catalogs.

To install properly follow these recommendations:


Translation into classes and template files in Magento 1 and Magento 2


Magento 1: for getting some word combination translated into the needed class or a template file, this type of functions should be used __(“your phrase”). So, there is a function put in the abstract class Mage_Core_Helper_Abstract. This class is on the following path: app/code/core/Mage/Core/Helper/Abstract.php. Then getTranslator() is called by the function, and the argument is passed to be translated.


Magento 2: use the same type of functions as in Magento 1 - __(“your phrase”). But here the object Phrase “return new \Magento\Framework\Phrase($text, $argc)” is created and returned by the function. Thus, translation happened in the class \Magento\Framework\Phrase.

The renderer information can be found in the following file: /vendor/magento/framework/Phrase/README.mdSo, the method _initTranslate() initiates translation in the file \Magento\Framework\App\Area.php.


Subdirectories and subdomains: do they worth using?

Strong points of subdirectories:

  • an easy management;
  • targeting of the separate folders;
  • SEO optimization is deeper;
  • transfer is easy.

Weak points:

  • possibility of a disorderly URL on big sites;
  • limited SERP;
  • possibility of the only hosting usage.

Strong points of subdomains:

  • usage of the only domain;
  • usability is the best;
  • possibility of particular subdomain placing in various countries.

Weak points:

  • maintaining of several subdomains is not easy;
  • requirement of the extra building.

Translating strings


Magento 1: translating strings takes place by means of the method Mage_Core_Helper_Abstract::__(). You can find it in controllers, blocks or helpers.


Magento 2: the mentioned above method is used as well, and can be found at the same places as in Magento 1. But the following file is involved: /vendor/magento/magento2-base/app/functions.php.


Influence of the developer mode


The enabled developer mode can disable the worldwide translation when duplicating is applied.

Translation of the specified in the translation file or module string is possible only within confines of this module.


Adding a custom translation

A custom translation can be added by means of the following options:

·       Module translation.

Create the necessary files:

Magento 1: Namespace_Modulename.csv in the folder app/locale/languagecode_COUNTRYCODE/.

Magento 2: languagecode_COUNTRYCODE.csv in the folder /app/code/Namespace/Modulename/i18n/.


·       Theme translation.

Create the necessary files:

Magento 1: translate.csv in the folder app/design/frontend/{package}/{theme}/locale/ languagecode_COUNTRYCODE.

Magento 2: languagecode_COUNTRYCODE.csv. Tnen put in the folder /app/design/{area}/{package}/{theme}/locale/i18n/.

The strings “Text” and “Translate text” are for the files *.csv  


·       Inline translation.

The route is System – Configuration – Developer. To enable the inline translation choose “Store View”.


Order of the translations loading

Magento 1:

1. module file /app/locale/languagecode_COUNTRYCODE/Namespace_Modulename.csv

2. theme CSV file/app/design/{area}/{package}/{theme}/locale/languagecode_COUNTRYCODE/translate.csv

3. database file (table core_translate)

Magento 2: pay attention to the files location change. The priority of the database translation is the highest, of the module translation – the minor, on the contrary.

1. /app/code/Namespace/Modulename/i18n/languagecode_COUNTRYCODE.csv

2. /app/design/{area}/{package}/{theme}/i18n/languagecode_COUNTRYCODE.csv

Conflict in translation of the same string


If such situation takes place, Magento proposes the ways of handling the situation and kiping the data for each module.The example can be of use:

1. For Namespace_Module1  “Text”, “Text 1” –  “Namespace_Module1:: Text”, “Text 2”

2. For Namespace_Module2  “Text”, “Text 2”  – “Namespace_Module2:: Text”, “Text 2”

Thus, for both modules there is one appropriate way: Mage::helper(‘Namespace_Module1’)->__(‘Text’).

In Magento 2 the situation is handled by means of loading translations from all modules first and then loading from the current one. 

Comments (0):
Leave a comment:
*Your comment will be published after approval by site administrator.