Translation folders in Magento 2 - Kussin | Development Unit Macedonia

Translation folders in Magento 2


languages, translation, .csv, i18n

04.08.2023 | Enisa Abazi | Blog, Development

 

What are Translation folders?

In Magento 2, translation folders are directories that store translation files for different languages. These translation files contain the translated text strings used in the Magento storefront or admin panel. Using translation folders, you can provide localized versions of your store to cater to different regions and languages.

There are two main translation folders in Magento 2:

  1. app/design/frontend/<Vendor>/<Theme>/i18n: This folder is used for frontend translations specific to your custom theme. If you are creating a custom theme for your Magento store, you can place translation files here to translate the text strings used in your theme’s templates, layouts, and JavaScript files.
  2. app/code/<Vendor>/<Module>/i18n: This folder is used for module-specific translations. If you have custom modules or third-party extensions installed on your Magento store, you can place translation files in this folder to translate the text strings used within those modules.

The translation files in these folders have the .csv file extension and follow a specific naming convention. The naming convention is as follows:

<language_code>.csv 

For example, if you want to provide French translations for your theme or module, you would create a file named fr_FR.csv within the respective i18n folder.

Each translation file contains a list of comma-separated values (CSV) with two columns: the original text string and its corresponding translation. For example:

“Original Text”,”Translated Text”
“Hello”,”Bonjour”
“Add to Cart”,”Ajouter au panier”

Magento will automatically use the appropriate translation file based on the user’s locale settings. If a translation is available for the user’s language, Magento will display the translated text; otherwise, it will fall back to the default text.

To enable translations, ensure that the locale is set correctly in the Magento configuration and that the translation files are properly placed in the respective i18n folders. Magento’s translation system will handle the rest and provide the appropriate translations based on the user’s locale.

Error: Contact form not found.