Get Free Audit

How to Implement Internationalization of Frontend Pages in Magento (CE+EE)

Nov 16, 2017

1274 David Narbutovich

How to Implement Internationalization of Frontend Pages in Magento (CE+EE)

We keep studying up on the Magento Certification exam which is considered as a great way to prove the knowledge on Magento. The article is dedicated to implementing internationalization of frontend pages including translation methods, its customization, transactional emails, and variables. Hope it helps you have a clue about the topic.

Which translation methods are available

In fact, there are four translation methods available:

  • Inline translation: you can get it enabled via the backend. The translation is stored in the database table “core_translate”.
  • Global translation package: the method can be performed via CSV files which are stored in the app/locale folder.
  • Theme translation: it can be done via CSV files. The method is similar to the global one, but it’s stored in app/design/frontend/<your_package>/<your_theme>/locale/<lg_LG>/translate.csv.
  • JavaScript translation: the method is performed via code such as Translator.add('Text to Translate', <?php echo $this->__('Text to Translate')).

How can translations be customized in an upgrade-safe manner

You should store the translations in the files “translate.csv” in the folder with the theme app/design/frontend/<your_package>/<your_theme>/locale/<lg_LG>/translate.csv, where lg_LG is a locale type, for example: en_US, en_GB.

How can translations be added for custom strings in templates

In order to translate a custom string, you need to use the following function:

For example,

How to implement internationalization of frontend pages 1(CE+EE)

%s is a placeholder which will be substituted by the parameters coming after the first argument of the function __(). Besides, there can be plenty of parameters.

Then you need to add the translation in the definite .csv file:

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

Don’t forget to duplicate the brackets within the string. The text is susceptible to the register
“Custom Str” is not equal to “Custom srt”
It’s also related to spaces

How to use the translation feature to customize the existing text

If you want to translate the text, for example (Out of stock),

You need to create or find the translation file for a specific language

Here is the path for the French translation of the default theme rwd:

Then, we need to add our translation:

How can translations be moved from one host to another

You need to copy local translation files to the remote server or add new entries from the core_translate database table if the inline translation is used. Then clear cache for:

  • Blocks HTML output
  • Translations
  • Full Page Cache

How can transactional emails be translated

In Magento there are default email templates, which can be edited via the admin panel:

  1. Go to System -> Transactional Emails
  2. Click the button “Add new template” and the form is opened
  3. In the form opened in the section “Load default template”, you need to select the generic template and necessary locale, then click the button “Load Template”
  4. Now you can start editing and translating the template (Template Content *)

The second way is to create a template in the folder containing email templates app/locale/{lang_ISO}/template/email

In this case, you need to copy the necessary template (or all templates) in the folder where the current locale is placed (in out example, this is fr_FR).

app/locale/en_US/template/email/account_new.html => app/locale/fr_FR/template/email/account_new.html

Then you can start translating the template.

How can variables be specified in transactional emails

In fact, this is a confused question because of the phrasing. It’s impossible to know if they mean local variables specific to an instance or local variables that can be changed focusing on locale.

If it’s focused on locale, there will be the following look:


In case if they are local variables specific to an instance, the look will be following:

{{customVar code="store_hours"}}

Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey


Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *