0
someVar = <?php echo $this->__("Yes") ?>

seems to not work. Even when I try console.log(<?php echo $this->__("Yes") ?>). Isn't $this->__() supposed to return just string?

I have the translation in the *.csv file and I know it's the correct one, because I work with other translations from that file in the same template.

2

Make sure that in JavaScript your script is still encapsulated in quotations. Try the following code taking note of the semicolon and quotations.

someVar = '<?php echo $this->__("Yes") ?>';
0

Thanks to @David Manners for the note, it was helpful. Nevertheless, what solved my problem was using this: '<?php echo Mage::helper('module_name')->__("Yes") ?>'.

  • was type $this not the same as the helper that is odd? – David Manners Jan 14 '14 at 16:16
  • @DavidManners - I know it's odd, because, as I said in the question, I use $this->__(...) for another translation from the same .csv file, in the same template and it works flawlessly... – Syspect Jan 15 '14 at 11:23

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.