1

I want to translate KO text.

"You have no items in your shopping cart."  "Empty Basket" 

Already tried with translate.csv it doesn't work.

Is there any way to translating knockout template text in magento2?

0

You Can try this its work for me.

find pub/static -name js-translation.json Add Translate in theme js-translation.json

For Example:

{"You have no items in your shopping cart.":"Empty Basket"}
{"Forgot Your Password?":"Forgot Password?"}

Once that's done we clear the cache:

php bin/magento cache:clean
php bin/magento cache:flush
  • 1
    It's working thanks, man! Can you explain where can locate that file in my theme? – Sanju Jun 12 '18 at 11:39
  • 1
    @SanjuAntala its auto-generated file, no need to copy that. Just add your text in translate.csv than clean your cache – user33979 Jun 12 '18 at 11:45
  • 1
    Thanx @Chetan its work for me. – Sanju Jun 12 '18 at 11:48
0

Try following code

<!-- ko i18n: 'You have no items in your shopping cart."  "Empty Basket' --><!-- /ko -->

Translate it into i18n directory of your module. & last thing is make deploy.

 rm -rf pub/static/frontend
 php -dmemory_limit=1G bin/magento setup:static-content:deploy -f
 chmod 777 -R var/ pub/static generated/
  • Wt happen when multiple texts translate? check @chetan above answer its works for me and it's easy to solution. – Sanju Jun 12 '18 at 12:08
  • Thanx, dude! For Replay... – Sanju Jun 12 '18 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.