Magento 2 Translations not working

Create a directory app/i18n/Vendorname/en_US

Issue command:

bin/magento i18n:collect-phrases --output "app/i18n/Vendorname/en_US/en_US.csv" --magento This will collect all the translatable phrases in csv file and place it in the specified path. Make changes to the csv file as per your requirement and when ready issue command:

bin/magento i18n:pack app/i18n/Vendorname/en_US/en_US.csv -d en_US

This will deploy the translations from your file.

clear the cache etc and you should see your changes.


You can change only text which is written in translation

Like : $this->__("Sample Taxt");

Suggested text not written in translation so you can not change it with translation.

If you want to change it, you can find it in JS file which is located :

vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rates-validator.js

Note : You have to override JS file to in your theme.

Delete pub/static/*

Run Command :

php bin/magento setup:static-content:deploy 

php bin/magento cache:clean

Delete browser cache.


Had the same problem on my Magento 2 website, tried all sorts of suggestions how to fix it but the only thing that worked for me was -

  1. go to /pub/static/frontend/<theme>/<theme>/<language for example pl_PL>

  2. Find js-translation.json and delete it (make a copy of it just in case!)

  3. Go back to your magento root folder and run php bin/magento setup:static-content:deploy pl_PL

  4. Then run php bin/magento cache:flush

That's it. If you go back to /pub/static/frontend/<theme>/<theme>/<language for example pl_PL> folder, notice that js-translation.json have been generated again.

This problem happens because when you run static deploy, magento generates js-translation.json file with all your translations inserted into this one file and calls it in every time the page is loaded. So when it's already generated and usually empty, it cannot overwrite it with new information. By deleting it and regenerating it will solve the problem.

Hope this is going to help somebody.