Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento 2 - translating strings in JS/KO

I need to translate the frontend of magento 2 to pt_BR, but I'm having a problem to translate the strings that are generated by the JS/KO. All my pages are translated normally with the .csv, but the JS/KO strings aren't. For example, I want to translate the button "GO TO CHECKOUT" from mini-cart, but I can't... How can I get it ? Anyone have any ideia to solve this ? I already flush the cache, run the command bin/magento setup:static-content:deploy, but didn't work for me.

like image 638
Otávio Moura Avatar asked Mar 08 '16 19:03

Otávio Moura


1 Answers

Check if the file pub/static/frontend/<Vendor>/<theme>/<locale>/js-translation.json exists and if it only contains [].

If so, you've been affected by a Magento 2 bug (js-translation.json not being generated properly).

The workaround is to remove this file and run php bin/magento setup:static-content:deploy <locale>. This should populate the file and make JS/KO translations work. You may also want to change file permissions on js-translation.json to prevent Magento from overwriting it again with [].

Source: https://github.com/magento/magento2/issues/2056#issuecomment-259641599

like image 103
Maciek Lewkowicz Avatar answered Sep 29 '22 12:09

Maciek Lewkowicz