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

Use default language if lng param not set in i18n req

This commit is contained in:
Nick O'Leary 2019-10-18 16:09:14 +01:00
parent 78b735276b
commit 29f1651a18
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -15,7 +15,7 @@
**/
var fs = require('fs');
var path = require('path');
//var apiUtil = require('../util');
// var apiUtil = require('../util');
var i18n = require("@node-red/util").i18n; // TODO: separate module
@ -41,7 +41,7 @@ module.exports = {
var namespace = req.params[0];
var lngs = req.query.lng;
namespace = namespace.replace(/\.json$/,"");
var lang = req.query.lng; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []);
var lang = req.query.lng || i18n.defaultLang; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []);
var prevLang = i18n.i.language;
// Trigger a load from disk of the language if it is not the default
i18n.i.changeLanguage(lang, function(){