diff --git a/src/UI/i18n/Locale.ts b/src/UI/i18n/Locale.ts index b970446830..b2e3ac58b3 100644 --- a/src/UI/i18n/Locale.ts +++ b/src/UI/i18n/Locale.ts @@ -2,6 +2,7 @@ import { UIEventSource } from "../../Logic/UIEventSource" import { LocalStorageSource } from "../../Logic/Web/LocalStorageSource" import { Utils } from "../../Utils" import { QueryParameters } from "../../Logic/Web/QueryParameters" +import Doc = Mocha.reporters.Doc export default class Locale { public static showLinkToWeblate: UIEventSource = new UIEventSource(false) @@ -63,9 +64,11 @@ export default class Locale { source = LocalStorageSource.Get("language", browserLanguage) } - source.addCallbackAndRun((l) => { - document.documentElement.setAttribute("lang", l) - }) + if (!Utils.runningFromConsole && typeof document !== undefined) { + source.addCallbackAndRun((l) => { + document.documentElement.setAttribute("lang", l) + }) + } if (!Utils.runningFromConsole) { // @ts-ignore