Magento – Custom Translation in Magento 2

localisationmagento2.2translate

I cannot make translation for Magento 2. What I've been doing is:

  1. Created a custom theme
  2. Now I want to apply some german translations
  3. Made a csv in vendor/theme/i18n/de_DE.csv
  4. Tried to bin/magento i18n:pack app/design/frontend/vendor/theme/i18n/de_DE.csv de_DE

But then an error occurs I don't know what to make of:

  Each row has to consist of 4 columns: original phrase, translation, context type, context value

My .csv content looks like:

"Search entire store here...", "Produktsuche"

What's the right way to make some lean theme tranlations without building an own language pack?

Best Answer

First run below command to collect phrases

bin/magento i18n:collect-phrases -m -o [test.csv]

You can see test.csv file in your Magento root folder.

Open file in excel and change 2nd column content

Second run below command

bin/magento i18n:pack test.csv de_DE -d

Note:-

  1. Change test.csv file based on your requirements.
  2. de_DE change based on your requirements.

I hope this is helpful to you.
Let me know if you still facing any issue.

Related Topic