How to Translate Magento 2 Extensions?

When you start translating your store to multiple languages, you often focus on products and categories, expecting Magento language packs to cover the rest. However, it is usually not enough to translate all of your labels and buttons. Why? Since a lot of them come from third-party extensions and need to be translated separately. 

Magento 2 extension vendors usually add translations for their modules. But covering all the languages out there is not always possible. That's why you need to learn how to translate the Magento extensions yourself. 

In this guide, we'll cover how you can add translations to the Magento extension using themes files or the admin panel. 

Translate Magento 2 Extension Using Theme Files

The Magento extension translations are commonly stored in .csv files on your server. However, if the translation for your language is missing, you need to create a new .csv file. 

1. Create a .csv file for translation

To simplify the process you can just go to the app/locale folder on your server and copy one of the files from there.

app/design/frontend/theme_vendor/theme_name/i18n/en_US.csv

Then rename it to your target language, changing just the language code: 

app/design/frontend/theme_vendor/theme_name/i18n/es-ES.csv

2. Add translations

The translations .csv file includes the original and target strings in double quotes, separated by a comma. So, don't use any other marks.

e.g. "Continue to Checkout", "Translated Text"

All the phrases are case-sensitive. So you should keep the translated phrase as it is in the original version.

e.g. "%s Item(s)","%s Elemento(s)"

3. Save the translations

Make sure the editor you use saves the UTF-8 encoding. If it doesn't convert it to the UTF encoding before saving.

This is how your translation file should look like:

magento translation

This method works for those comfortable working with the code, or developers who want to add translations to their own Magento 2 extension. 

If none of this is about you, we have an easier way to translate Magento 2 extensions for you.

Translate Magento 2 Extension Using Admin Panel

Sometimes developers miss some translations in their extensions or the translations are simply not accurate. In this case, you need to edit the translations or add your own. But to do that from the admin panel, you need the Magento 2 Translation Extension

The best part is — this module finds all texts available for translation in Magento 2 extensions automatically. You just need to do the translation. 

1. Filter text available for translation

To find the text you can translate in a third-party extension, you can use filters, the Source filter in particular. 

magento translation filters

2. Add translations

Once you apply the filters you get the list of all texts you can translate. Simply click on the locale you want to add a translation for to open the editing panel. You can add translations for one or multiple languages at once. 

translate magento 2 extensions

After you save the translations, they apply immediately. Just clean Magento caches and check them on the frontend.

Note: if you can't find some phrases you see on the frontend in this section, it means that the extension vendors didn't wrap that text in the translation function. So, you need to enable path hints, find a template where a particular text is located, and wrap it in the translation function. Only then should you be able to find that text in the Search and Translate panel.

That's how you translate Magento 2 extensions. As you can see, it is much easier with the translation tool.

However, don't forget that labels and buttons are just a tiny part of Magento localization. The next step is to translate products, categories and email templates.