Added try/catch on util-language just in case

This commit is contained in:
Bryan Roe 2022-01-12 23:47:39 -08:00
parent 8fe748b4f3
commit da0f59bc9a
1 changed files with 9 additions and 4 deletions

View File

@ -96,12 +96,17 @@ function setDefaultCoreTranslation(obj, field, value)
function getCoreTranslation() function getCoreTranslation()
{ {
var ret = {}; var ret = {};
var lang = require('util-language').current;
if (global.coretranslations != null) if (global.coretranslations != null)
{ {
if (coretranslations[lang] == null) { lang = lang.split('-')[0]; } try
if (coretranslations[lang] == null) { lang = 'en'; } {
if (coretranslations[lang] != null) { ret = coretranslations[lang]; } var lang = require('util-language').current;
if (coretranslations[lang] == null) { lang = lang.split('-')[0]; }
if (coretranslations[lang] == null) { lang = 'en'; }
if (coretranslations[lang] != null) { ret = coretranslations[lang]; }
}
catch (x)
{ }
} }
setDefaultCoreTranslation(ret, 'allow', 'Allow'); setDefaultCoreTranslation(ret, 'allow', 'Allow');