11

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

asked Feb 6, 2017 at 12:41

2 Answers 2

10

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

answered Feb 6, 2017 at 12:52
1
  • 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. Commented May 19, 2017 at 6:50
5

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.

answered Apr 20, 2017 at 11:10
1
  • Doing the same thing here. Really stupid way but better than nothing. Commented Jul 31, 2017 at 20:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.