In this post I am going to explain how to add or generate language translation csv in Magento 2.
In order to add translation csv file in magento2, first you need to create one folder named “i18n” inside your module’s folder.
For Example, app/code/Namespace/Module/i18n
Next to that, create a csv file name of language code.
For Example,
English (United state) -> en_US.csv
French (France) -> fr_FR.csv
In csv file you need to add words and sentences which you want to translate in following way.
You can also generate the translation csv file from command line. Here I have generated from my custom module – Ht_Mymodule
1 | php bin/magento i18n:collect-phrases --output="/var/www/magento2/app/code/Ht/Mymodule/i18n/en_US.csv" /var/www/magento2/app/code/Ht/Mymodule |
Now, open the newly generated csv file and add/edit the words and sentences as per your need.
After done with editing run the static content deploy command.
1 | php bin/magento setup:static-content:deploy -f |
Note: Without running deploy command you can’t get your localization changes.
Thats it.
Write an article about ecommerce that help people to grow their ecommerce business. You’ll find best ecommerce guide, news, tips & more!
Leave a Reply