Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client: Fix restoring language on mobile
Elian Dorane87ef882d5d7
diff --git a/integration-tests/i18n.spec.ts b/integration-tests/i18n.spec.tsindex b7fc6f95b0..0e700ad47b 100644--- a/integration-tests/i18n.spec.ts+++ b/integration-tests/i18n.spec.ts@@ -15,7 +15,7 @@ test("User can change language from settings", async ({ page }) => {// Check that the default value (English) is set.await expect(page.locator('#center-pane')).toContainText('Theme');const languageCombobox = await page.getByRole('combobox').first();- expect(languageCombobox).toHaveValue("en");+ await expect(languageCombobox).toHaveValue("en");// Select Chinese and ensure the translation is set.languageCombobox.selectOption("cn");@@ -23,4 +23,21 @@ test("User can change language from settings", async ({ page }) => {// Select English again.languageCombobox.selectOption("en");+});++test("Restores language on start-up on desktop", async ({ page, context }) => {+ await page.goto('http://localhost:8082');+ await expect(page.locator('#launcher-pane').first()).toContainText("Open New Window");+});++test("Restores language on start-up on mobile", async ({ page, context }) => {+ await context.addCookies([+ {+ url: "http://localhost:8082",+ name: "trilium-device",+ value: "mobile"+ }+ ]);+ await page.goto('http://localhost:8082');+ await expect(page.locator('#launcher-pane div').first()).toContainText("Open New Window");});\ No newline at end of filediff --git a/src/public/app/mobile.js b/src/public/app/mobile.jsindex 3b03c33226..1c95324f50 100644--- a/src/public/app/mobile.js+++ b/src/public/app/mobile.js@@ -3,7 +3,7 @@ import glob from "./services/glob.js";glob.setupGlobs()-appContext.earlyInit();+await appContext.earlyInit();// A dynamic import is required for layouts since they initialize components which require translations.const MobileLayout = (await import("./layouts/mobile_layout.js")).default;