From de9dca54bd2258530ce3f5941842b02e97e7e8d7 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 12 Dec 2023 19:26:15 +0100 Subject: [PATCH] Fix build --- src/UI/i18n/Locale.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/UI/i18n/Locale.ts b/src/UI/i18n/Locale.ts index b97044683..b2e3ac58b 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