From 4e4871c281655dff5cecf75c8d085e3cd487d2f9 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 9 Jan 2020 13:56:14 -0700 Subject: [PATCH] Move lang import to the top of the file --- src/languageHandler.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/languageHandler.js b/src/languageHandler.js index c31db5eb5b..3a061df915 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -22,6 +22,9 @@ import counterpart from 'counterpart'; import React from 'react'; import SettingsStore, {SettingLevel} from "./settings/SettingsStore"; +// $webapp is a webpack resolve alias pointing to the output directory, see webpack config +import webpackLangJsonUrl from "$webapp/i18n/languages.json"; + const i18nFolder = 'i18n/'; // Control whether to also return original, untranslated strings @@ -417,9 +420,7 @@ function getLangsJson() { return new Promise(async (resolve, reject) => { let url; try { - // $webapp is a webpack resolve alias pointing to the output directory, see webpack config - url = import('$webapp/i18n/languages.json'); - if (url.then) url = (await url).default; // webpack resolves to a Module through a promise. + url = webpackLangJsonUrl; } catch (e) { url = i18nFolder + 'languages.json'; }