0

I have created a custom email template, all works well everything is shown, except when I use the trans dictionary to translate a string from English to German, the translation does not seem to work.

I have provided a de_DE.csv file but still the text it not being translated. Cleared cache, reindexed.

2

Magento 2 Translation in Custom Email Template
For Example:

{{trans "Shipping Info"}}

First, create a CSV file in your theme with the name de_DE.csv

app/design/frontend/[Your_Vendor]/[Your_Theme]/i18n/de_DE.csv

Add your English and DE translation text in the double quote like below:

Use for Email:

"Shipping Info","Lieferadresse",module,Magento_Email

Use for the Whole website:

"Shipping Info","Lieferadresse"

2
  • very nice explanation thanks @Vikram Kumar – Navin Bhudiya Sep 12 '20 at 13:10
  • welcome @NavinBhudiya – Vikram Kumar Sep 12 '20 at 13:10
0

For Email template translate string in m2 you need to wirte code like this.

{{trans "%items are shipping today." items=shipment.getItemCount}}

and when you check in browser, you need to clear cache and local storage from Broswer. http://prntscr.com/r02pu4

0

it's mistake, used : instead of , in the csv file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.