...
To use a string in JavaScript we require that it is loaded into the final page for example to load the strings required by the Hotspot question type we have the following included in one of the Twig templates:
Code Block | ||
---|---|---|
| ||
<script> requirejs(['lang'], function(lang) { lang.set_strings({ {% for id, string in lang %} '{{id}}': '{{string|e('js')}}', {% endfor %} }, 'html5'); }); </script> |
...