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:
parent
78b735276b
commit
29f1651a18
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
//var apiUtil = require('../util');
|
// var apiUtil = require('../util');
|
||||||
|
|
||||||
var i18n = require("@node-red/util").i18n; // TODO: separate module
|
var i18n = require("@node-red/util").i18n; // TODO: separate module
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ module.exports = {
|
|||||||
var namespace = req.params[0];
|
var namespace = req.params[0];
|
||||||
var lngs = req.query.lng;
|
var lngs = req.query.lng;
|
||||||
namespace = namespace.replace(/\.json$/,"");
|
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;
|
var prevLang = i18n.i.language;
|
||||||
// Trigger a load from disk of the language if it is not the default
|
// Trigger a load from disk of the language if it is not the default
|
||||||
i18n.i.changeLanguage(lang, function(){
|
i18n.i.changeLanguage(lang, function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user