🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Translate Using XML in Magento 2

By Sanjay JethvaUpdated on Jul 17, 2025 2 min read

It is a general observation that customers prefer viewing online content, especially when it comes to E-commerce, in their native languages. And why not! Online visitors are very impatient. So offer them what they love, what is easily readable, and content that they can grasp quickly.

Now, as Magento 2 is a worldwide popular platform used by online businesses in multiple languages, translating the store’s content is inevitable.

Translating the store’s content can lead to more sales because international customers can better understand the product details and can relate to your business on a higher level.

Now, if you have tried translating using CSV but failed, you probably missed a step. And that’s why you need to follow this method to translate using XML in Magento 2.

Method to translate using XML in Magento 2:

As a Magento developer, it is a common practice for translating words through .csv file located at

app/code/Vendor/Extension/i18n

Just add i18n folder in custom extension and in that, create .csv file with a translation of words like “Click Here”, “Klik hier”.

Observe that, the name of CSV starts with language name like en_US.csv, ar_SA.csv etc.

Despite following these steps, if some words are not translating in your store, then probably you might have missed, as shown below:

If you want to translate “city” field in dutch language from English and you’ve passed that field like below:

<item name="label" xsi_type="string" >City</item>

In CSV file you’ve done every step perfectly like “city”, “stad” but word city is not translating then once check your XML file.

The correct method, which you have forgotten is:

<item name="label" xsi_type="string" translate="true">City</item>

That’s it.

Adding translate=”true” is what you had skipped but not after following this post!

And yeah…let me remind you to use echo __(‘your word’) in phtml file too

If you’re looking for the method to translate JS error message or text In Magento 2 then visit our blog.

If you are Switching to an Arabic store or changing the store view to Arabic changes and want to Change Price Decimal Separator for Arabic Store in Magento 2 Read our blog. Do share the tutorial with fellow Magento developers via social media.

Thank you.

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.