The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(native): keep a chosen language on the app sign-in screen
Maurice81b66d31701e
diff --git a/client/src/pages/login/useLogin.native.test.tsx b/client/src/pages/login/useLogin.native.test.tsxindex 352d6a7b3..a7c43a1bf 100644--- a/client/src/pages/login/useLogin.native.test.tsx+++ b/client/src/pages/login/useLogin.native.test.tsx@@ -1,4 +1,4 @@-// FE-LOGIN-NATIVE-001 to FE-LOGIN-NATIVE-011: useLogin inside the iOS/Android app+// FE-LOGIN-NATIVE-001 to FE-LOGIN-NATIVE-012: useLogin inside the iOS/Android appimport { startAuthentication } from '@simplewebauthn/browser';import { http, HttpResponse } from 'msw';import React from 'react';@@ -166,8 +166,7 @@ describe('useLogin in the native app', () => {expect(result.current.showTakeoff).toBe(false);});- it('FE-LOGIN-NATIVE-009: speaks the device language, over a language once picked on this page', async () => {- localStorage.setItem('app_language', 'fr');+ it('FE-LOGIN-NATIVE-009: speaks the device language when no language was chosen', async () => {deviceLanguages(['de-DE', 'en-US']);renderLogin();await waitFor(() => expect(useSettingsStore.getState().settings.language).toBe('de'));@@ -190,4 +189,13 @@ describe('useLogin in the native app', () => {await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('/'), { timeout: 2500 });expect(document.documentElement.hasAttribute('data-app-handover')).toBe(true);});++ it('FE-LOGIN-NATIVE-012: keeps a language once picked on this page over the device language', async () => {+ localStorage.setItem('app_language', 'fr');+ useSettingsStore.setState((state) => ({ settings: { ...state.settings, language: 'fr' } }));+ deviceLanguages(['de-DE', 'en-US']);+ const { result } = renderLogin();+ await waitFor(() => expect(result.current.appConfig).not.toBeNull());+ expect(useSettingsStore.getState().settings.language).toBe('fr');+ });});diff --git a/client/src/pages/login/useLogin.ts b/client/src/pages/login/useLogin.tsindex 42b718253..ba76b0b87 100644--- a/client/src/pages/login/useLogin.ts+++ b/client/src/pages/login/useLogin.ts@@ -300,16 +300,16 @@ export function useLogin() {// 2. Browser/OS language (navigator.languages)// 3. Server default (DEFAULT_LANGUAGE env var)// 4. 'en' → hardcoded fallback already in store- // Inside the iOS and Android app the sign-in screen has no language menu: it- // speaks the device's language, as the address screen before it does, and- // English where TREK has no translation for it. The account's own language- // takes over once signed in.+ // Inside the iOS and Android app the sign-in screen has no language menu: unless+ // a language was chosen before, it speaks the device's language, as the address+ // screen before it does, and English where TREK has no translation for it. The+ // account's own language takes over once signed in.useEffect(() => {+ if (hasStoredLanguage()) returnif (nativeApp) {setLanguageTransient(detectBrowserLanguage() ?? 'en')return}- if (hasStoredLanguage()) returnconst detected = detectBrowserLanguage()if (detected) {