Stable sorted translations in the list

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2022-12-24 14:31:38 +01:00
parent cd90d97c42
commit 5cf6282a53

View file

@ -4,7 +4,7 @@
// there were no previous redirects or explicit language selections before (see language_seletor.html)
if (null === window.localStorage.getItem('lang')) {
// ["en", "ru", ...]
var pageTranslations = {{ resource.translations | map(attribute="lang") | json_encode() | safe }};
var pageTranslations = {{ resource.translations | map(attribute="lang") | sort | json_encode() | safe }};
var userPreferredLanguages = navigator.languages ? navigator.languages : [navigator.language];
outerLoop:
for (var i = 0; i < userPreferredLanguages.length; i++) {