Skip to content

Commit

Permalink
Update getTranslations.js.twig (#317)
Browse files Browse the repository at this point in the history
The filter "raw" is necessary to encode language with subtags in javascript file, otherwise there is an error on locale code ("en\u002DUS" for example).
  • Loading branch information
AngelikLy authored Sep 2, 2022
1 parent 73fafb1 commit 44877e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Resources/views/getTranslations.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ t.fallback = '{{ fallback }}';
t.defaultDomain = '{{ defaultDomain }}';
{% endif %}
{% for locale, domains in translations %}
// {{ locale }}
// {{ locale|raw }}
{% for domain, messages in domains %}
{% for key, message in messages %}
t.add({{ key|json_encode|raw }}, {{ message|json_encode|raw }}, "{{ domain }}", "{{ locale }}");
t.add({{ key|json_encode|raw }}, {{ message|json_encode|raw }}, "{{ domain }}", "{{ locale|raw }}");
{% endfor %}
{% endfor %}
{% endfor %}
Expand Down

0 comments on commit 44877e6

Please sign in to comment.