Skip to content

Commit 7123b67

Browse files
committed
only include the preferred locale's translations in the page
I'm trying to cut the page size down.
1 parent 4ecf724 commit 7123b67

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

editor/templates/numbas_runtime.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
<script>
77
Numbas.queueScript('localisation-resources',['i18next'],function() {
88
Numbas.locale = {
9-
preferred_locale: {% if user.is_authenticated %}"{{user.userprofile.language}}"{% else %}"en-GB"{% endif %},
9+
{% with preferred_locale=user.userprofile.language|default_if_none:"en-GB" %}
10+
preferred_locale: "{{preferred_locale}}",
1011
resources: {
1112
{% for name,locale in NUMBAS_LOCALES %}
12-
"{{locale|lower}}": {"translation":{% raw_include "js/numbas/locales/"|add:locale|add:".json" %} },
13+
{% if locale == preferred_locale %}"{{locale|lower}}": {"translation":{% raw_include "js/numbas/locales/"|add:locale|add:".json" %} },{% endif %}
1314
{% endfor %}
1415
}
16+
{% endwith %}
1517
}
1618
});
1719
</script>

0 commit comments

Comments
 (0)