From 345b3eca87f1b83ebeb1637ae66ffcf4027f30f9 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 7 Jun 2026 17:44:38 +0200 Subject: [PATCH] =?UTF-8?q?fix(search):=20replace=20languageTag()=20with?= =?UTF-8?q?=20getLocale();=20sync=20KI=E2=86=92Smart=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Paraglide 2.5 runtime exports getLocale(), not languageTag(). The 8bed0cc6 commit introduced the wrong import when threading lang through the NL search path. Also updates two test assertions that still expected the old 'KI' button label after 0b31a51e renamed it to 'Smart-Suche'. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/routes/SearchFilterBar.svelte.spec.ts | 2 +- frontend/src/routes/documents/+page.svelte | 4 ++-- frontend/src/routes/search/SmartModeToggle.svelte.spec.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/routes/SearchFilterBar.svelte.spec.ts b/frontend/src/routes/SearchFilterBar.svelte.spec.ts index fa389d8c..1de166f2 100644 --- a/frontend/src/routes/SearchFilterBar.svelte.spec.ts +++ b/frontend/src/routes/SearchFilterBar.svelte.spec.ts @@ -209,7 +209,7 @@ describe('SearchFilterBar – smart-mode chip lifecycle hooks', () => { smartMode: true, onModeToggle }); - await page.getByRole('button', { name: /KI/ }).click(); + await page.getByRole('button', { name: /Smart/ }).click(); expect(onModeToggle).toHaveBeenCalledOnce(); }); diff --git a/frontend/src/routes/documents/+page.svelte b/frontend/src/routes/documents/+page.svelte index 92556463..ad3744f5 100644 --- a/frontend/src/routes/documents/+page.svelte +++ b/frontend/src/routes/documents/+page.svelte @@ -17,7 +17,7 @@ import { bulkSelectionStore } from '$lib/document/bulkSelection.svelte'; import { getErrorMessage, parseBackendError } from '$lib/shared/errors'; import { csrfFetch } from '$lib/shared/cookies'; import * as m from '$lib/paraglide/messages.js'; -import { languageTag } from '$lib/paraglide/runtime'; +import { getLocale } from '$lib/paraglide/runtime'; import type { components } from '$lib/generated/api'; type NlQueryInterpretation = components['schemas']['NlQueryInterpretation']; @@ -225,7 +225,7 @@ async function runSmartSearch() { const res = await csrfFetch('/api/search/nl', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ query, lang: languageTag() }) + body: JSON.stringify({ query, lang: getLocale() }) }); if (!res.ok) { const backend = await parseBackendError(res); diff --git a/frontend/src/routes/search/SmartModeToggle.svelte.spec.ts b/frontend/src/routes/search/SmartModeToggle.svelte.spec.ts index 01347271..1661a50e 100644 --- a/frontend/src/routes/search/SmartModeToggle.svelte.spec.ts +++ b/frontend/src/routes/search/SmartModeToggle.svelte.spec.ts @@ -22,7 +22,7 @@ describe('SmartModeToggle', () => { it('shows the smart label when smartMode is true', async () => { render(SmartModeToggle, { smartMode: true }); const btn = page.getByRole('button'); - await expect.element(btn).toHaveTextContent('KI'); + await expect.element(btn).toHaveTextContent('Smart'); }); it('shows the keyword label when smartMode is false', async () => {