1
0
forked from 0ad/0ad

Do not break gui when fallback language is not available in termsdialog.js

L10 falls back to language code, that means if "pt_x" is not available
it falls back to "pt", but we do not provide "pt", same for "en" or
after uninstalling and removing language pack and leaving language
selected.
Adding warning.

Related post:
https://wildfiregames.com/forum/topic/96800-terms-display-error

This was SVN commit r27201.
This commit is contained in:
Angen 2022-11-05 08:19:32 +00:00
parent 33dd5d9fbc
commit 467541cfad

View File

@ -62,8 +62,11 @@ function initLanguageSelection()
// current locale
let currentLocaleDict = Engine.GetFallbackToAvailableDictLocale(Engine.GetCurrentLocale());
if (currentLocaleDict != baseNames[0])
list.push(displayNames[baseNames.indexOf(currentLocaleDict)]);
let index = baseNames.indexOf(currentLocaleDict);
if (index == -1)
warn("Language '"+currentLocaleDict+"' is not available");
else if (currentLocaleDict != baseNames[0])
list.push(displayNames[index]);
return list;
})();