1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

dont try to load en-gb or en-us (they're builtin)

- also monaco now comes with Turkish, Polish, Portuguese, Czech langs
This commit is contained in:
Steve-Mcl 2021-06-24 11:25:26 +01:00
parent a4e0abb48f
commit 7f30748a41

View File

@ -2,9 +2,8 @@
var _isIE = /MSIE \d|Trident.*rv:/.test(navigator.userAgent);
//dont load monaco if IE
if(_isIE === false) {
var defaultLanguage = 'en-gb';
var userLocale = (localStorage.getItem("editor-language") + "")
var browserLocale = typeof navigator === "undefined" ? "" : (navigator.language || navigator.userLanguage);
var browserLocale = typeof navigator === "undefined" ? "" : (navigator.language || navigator.userLanguage || "");
var cultureDists = {
"zh-cn":"zh-hans",
"zh-tw":"zh-hant",
@ -15,9 +14,12 @@
"it":"it",
"es":"es",
"ru":"ru",
"en-us":"en-gb"
"tr":"tr",
"pl":"pl",
"pt-br":"pt-br",
"cs":"cs"
};
var uiLanguage = cultureDists[userLocale.toLowerCase()] || cultureDists[browserLocale.toLowerCase()] || defaultLanguage;
var uiLanguage = cultureDists[userLocale.toLowerCase()] || cultureDists[browserLocale.toLowerCase()];
if(uiLanguage) document.write('<script src="vendor/monaco/dist/locale/' + uiLanguage + '.js"><\/script>');
document.write('<script src="vendor/monaco/dist/editor.js"><\/script>');
}