Magento – Magento 2 – Translations : how does js-translation.json get populated? Mine is empty!

magento2

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

Best Answer

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

Related Topic