mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 22:17:31 +03:00
noVNC language is now sync'ed with MeshCentral.
This commit is contained in:
parent
45cbb73547
commit
caba53ff68
@ -20,9 +20,11 @@ export class Localizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure suitable language based on user preferences
|
// Configure suitable language based on user preferences
|
||||||
setup(supportedLanguages) {
|
setup(supportedLanguages, language) {
|
||||||
this.language = 'en'; // Default: US English
|
this.language = 'en'; // Default: US English
|
||||||
|
|
||||||
|
if (language != null) { this.language = language; return; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Navigator.languages only available in Chrome (32+) and FireFox (32+)
|
* Navigator.languages only available in Chrome (32+) and FireFox (32+)
|
||||||
* Fall back to navigator.language for other browsers
|
* Fall back to navigator.language for other browsers
|
||||||
|
@ -1658,7 +1658,8 @@ const UI = {
|
|||||||
|
|
||||||
// Set up translations
|
// Set up translations
|
||||||
const LINGUAS = ["cs", "de", "el", "es", "ko", "nl", "pl", "ru", "sv", "tr", "zh_CN", "zh_TW"];
|
const LINGUAS = ["cs", "de", "el", "es", "ko", "nl", "pl", "ru", "sv", "tr", "zh_CN", "zh_TW"];
|
||||||
l10n.setup(LINGUAS);
|
if (urlargs.l == "zh-chs") { urlargs.l = "zh_CN"; }
|
||||||
|
l10n.setup(LINGUAS, urlargs.l);
|
||||||
if (l10n.language === "en" || l10n.dictionary !== undefined) {
|
if (l10n.language === "en" || l10n.dictionary !== undefined) {
|
||||||
UI.prime();
|
UI.prime();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2270,7 +2270,7 @@
|
|||||||
newWindow.opener = null;
|
newWindow.opener = null;
|
||||||
}
|
}
|
||||||
} else if (message.tag == 'novnc') {
|
} else if (message.tag == 'novnc') {
|
||||||
var vncurl = window.location.origin + domainUrl + 'novnc/vnc.html?ws=wss%3A%2F%2F' + window.location.host + '%2Fmeshrelay.ashx%3Fauth%3D' + message.cookie + '&show_dot=1' + (urlargs.key?('&key=' + urlargs.key):'');
|
var vncurl = window.location.origin + domainUrl + 'novnc/vnc.html?ws=wss%3A%2F%2F' + window.location.host + '%2Fmeshrelay.ashx%3Fauth%3D' + message.cookie + '&show_dot=1' + (urlargs.key?('&key=' + urlargs.key):'') + '&l={{{lang}}}';
|
||||||
var node = getNodeFromId(message.nodeid);
|
var node = getNodeFromId(message.nodeid);
|
||||||
if (node != null) { vncurl += '&name=' + encodeURIComponentEx(node.name); }
|
if (node != null) { vncurl += '&name=' + encodeURIComponentEx(node.name); }
|
||||||
var newWindow = window.open(vncurl, 'mcnovnc/' + message.nodeid);
|
var newWindow = window.open(vncurl, 'mcnovnc/' + message.nodeid);
|
||||||
|
@ -5823,11 +5823,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||||||
var fileOptions = obj.renderPages[obj.path.basename(filename)];
|
var fileOptions = obj.renderPages[obj.path.basename(filename)];
|
||||||
if (fileOptions != null) {
|
if (fileOptions != null) {
|
||||||
for (var i in acceptLanguages) {
|
for (var i in acceptLanguages) {
|
||||||
if ((acceptLanguages[i] == 'en') || (acceptLanguages[i].startsWith('en-'))) { break; } // English requested, break out.
|
if ((acceptLanguages[i] == 'en') || (acceptLanguages[i].startsWith('en-'))) { args.lang = 'en'; break; } // English requested, break out.
|
||||||
if (fileOptions[acceptLanguages[i]] != null) {
|
if (fileOptions[acceptLanguages[i]] != null) {
|
||||||
// Found a match. If the file no longer exists, default to English.
|
// Found a match. If the file no longer exists, default to English.
|
||||||
obj.fs.exists(fileOptions[acceptLanguages[i]] + '.handlebars', function (exists) {
|
obj.fs.exists(fileOptions[acceptLanguages[i]] + '.handlebars', function (exists) {
|
||||||
if (exists) { args.lang = acceptLanguages[i]; res.render(fileOptions[acceptLanguages[i]], args); } else { res.render(filename, args); }
|
if (exists) { args.lang = acceptLanguages[i]; res.render(fileOptions[acceptLanguages[i]], args); } else { args.lang = 'en'; res.render(filename, args); }
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user