سؤال

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

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") ?>'.

نصائح أخرى

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") ?>';
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top