You are viewing: Troubleshooting
In this article you will learn how to perform Magento 2 theme files translation. Usually, the translations are being stored in the .csv files on your server. However, if for some reason there's no CSV translation file translated for your language - you will need to create the .csv file from scratch. To create the CSV translation file - please follow the steps below.
Make sure to disable Magento 2 cache before proceeding with .csv file translation.
1. First in your Magento 2 admin panel you need to find the .csv file and copy it to create the required file for the translation. Please, check the example below.
This is an example of the file for German translation:
2. While translating, make sure all the strings in your .csv file start and end with double quotes, and are separated with comma [,], not semi-colon [;] or any other mark.
"Add to Cart", "Translated Text"
3. You can change the default theme strings according to the requirements of your website.
"My Cart","My Basket" "My Account","Your Account"
4. All the lines are case-sensitive, you should copy the phrase exactly as it is in the "en_US" version.
In the source "en_US" version the text looks like this:
"%s Item(s)","%s Item(s)"
The translated text should look like this:
"%s Items","%s Product(s)"
5. Make sure your text editor saves .csv file in UTF-8 encoding, as it supports different alphabets. If you edit the file using Excel, convert it into UTF-8 encoding once you finish editing.
6. If you need to set off a word or phrase by quotation marks, put two double quotation marks for such string.
You can also use html coding to alter your text. Check an example:
6. While performing translation in this file - any word or phrase will be translated for the entire theme. If you need to translate same element in different ways for different pages, you can use this example:
"Mage_Catalog:Add to Cart","Add to Basket" "Mage_Checkout:Add to Cart","Add to my shopping cart"
To read more information about Magento 2 translations, please click here.