You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Move lang import to the top of the file
This commit is contained in:
@@ -22,6 +22,9 @@ import counterpart from 'counterpart';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import SettingsStore, {SettingLevel} from "./settings/SettingsStore";
|
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/';
|
const i18nFolder = 'i18n/';
|
||||||
|
|
||||||
// Control whether to also return original, untranslated strings
|
// Control whether to also return original, untranslated strings
|
||||||
@@ -417,9 +420,7 @@ function getLangsJson() {
|
|||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
let url;
|
let url;
|
||||||
try {
|
try {
|
||||||
// $webapp is a webpack resolve alias pointing to the output directory, see webpack config
|
url = webpackLangJsonUrl;
|
||||||
url = import('$webapp/i18n/languages.json');
|
|
||||||
if (url.then) url = (await url).default; // webpack resolves to a Module through a promise.
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
url = i18nFolder + 'languages.json';
|
url = i18nFolder + 'languages.json';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user