Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
languagenone
<script>
    requirejs(['lang'], function(lang) {
      lang.set_strings({
        {% for id, string in lang %}
          '{{id}}': '{{string|e('js')}}',
        {% endfor %}
      }, 'html5');
    });
</script>

...