Translation method does not work
-
16-10-2019 - |
سؤال
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") ?>';
لا تنتمي إلى magento.stackexchange