Community Version 2.1.3.
Locale is set to en_GB (English United Kingdom). Using Luma theme.
I have my en_GB.csv translation file set up and my translation is in there:
"You have no items in your shopping cart.","You have no items in your shopping basket!"
When I go to the basket page (it's empty) I can see my translation fine! However when I hover over the minicart the overlay does not translate. It continues to say "You have no items in your shopping cart.".
I understand that I need a pub/static/frontend/[Theme]/default/en_GB/js-translation.json file with the translation in there too. But when I try a static deploy "bin/magento setup:static-content:deploy en_GB" it creates the file but it's empty.
I also believe there's a var/view_preprocessed/source/frontend/[Theme]/default/en_GB/js-translation.json too.
So what do I need to clear or flush or whatever to get this file populated?
Do I need to do something with a language pack maybe?
Thanks Tadhg
2 Answers 2
It seems that if you delete js-translation.json from pub/static/frontend/Magento/[theme]/[lang_code]/ that allows the "setup:static-content:deploy [lang_code]" to correctly generate the file.
It worked for me but this looks very much like a Magento Bug. One can survive with this workaround fix in dev environment but I'm not sure how deployment to production will work.
Maybe somebody has a better answer hopefully.
Cheers Tadhg
-
oh thank you so much for this!! All json files were empty. Removed them all and then generated only for the extra language i needed.LefterisL– LefterisL2017年05月19日 06:50:36 +00:00Commented May 19, 2017 at 6:50
This is a known Magento 2 bug, currently there are 22 open bugs related to js-translation.json in Magento 2.
https://github.com/magento/magento2/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20js-translation
One workaround that we do is to generate a json-translation.json file yourself and then configuring your web-server to automatically deliver it instead of the Magento 2 file.
-
Doing the same thing here. Really stupid way but better than nothing.dchayka– dchayka2017年07月31日 20:11:50 +00:00Commented Jul 31, 2017 at 20:11