I write PHP inside JS in the following way
alert(<?php echo __("Error-login") ?>);
echo__("Error-login")
correlates with an xml to translate in two languages with symfony, but now it does not work.
How do I fix this?
I write PHP inside JS in the following way
How do I fix this? |
||||
try this
|
|||
|
Your line becomes
As you can see, you are missing the quotes:
If somebody uses quotes in the translation, this will also generate an error:
So you need to escape single quotes before you pass it to Javascript. |
|||
|
You are missing quotes in the
|
|||
|
;
in'<?php echo __("Error-login"); ?>'
– mgraph Mar 9 '12 at 9:48