Add fallback for languages file

So we're not completely dependent on the alias being set
This commit is contained in:
David Baker 2019-03-01 11:44:44 +00:00
parent 63c6f600bf
commit 53aceaa412

View File

@ -338,8 +338,13 @@ export function getCurrentLanguage() {
function getLangsJson() {
return new Promise((resolve, reject) => {
// Webapp is a webpack resolve alias pointing to the output directory, see webpack config
const url = require('Webapp/i18n/languages.json');
let url;
try {
// Webapp is a webpack resolve alias pointing to the output directory, see webpack config
url; = require('Webapp/i18n/languages.json');
} catch (e) {
url = i18nFolder + 'languages.json';
}
request(
{ method: "GET", url },
(err, response, body) => {