feat(i18n): fix remaining hardcoded strings + login page language switcher #16

Merged
marcel merged 5 commits from feat/i18n-missing-strings into main 2026-03-19 21:04:06 +01:00
Owner

Summary

  • 9 new translation keys added to de.json, en.json, es.json — covering document preview errors, tooltips, image alt text, date fallback, merge warning suffix, and admin delete confirm
  • documents/[id]/+page.svelte — 6 hardcoded strings replaced with m.*() (preview error, download tooltip, tag filter tooltip, conversation tooltip, iframe title, image alt)
  • persons/[id]/+page.svelte"wird gelöscht." and "Kein Datum" replaced
  • admin/+page.svelteconfirm() dialog replaced with m.admin_user_delete_confirm({ username })
  • login/+page.svelte — DE/EN/ES language switcher added top-right (Option B), form labels wired to existing login_* keys

Closes #12

Test plan

  • npm run check passes (0 errors)
  • Login page shows DE/EN/ES buttons top-right; clicking switches language and persists after login
  • Document detail page tooltips and labels translate correctly
  • Admin delete confirm dialog translates correctly

🤖 Generated with Claude Code

## Summary - **9 new translation keys** added to `de.json`, `en.json`, `es.json` — covering document preview errors, tooltips, image alt text, date fallback, merge warning suffix, and admin delete confirm - **`documents/[id]/+page.svelte`** — 6 hardcoded strings replaced with `m.*()` (preview error, download tooltip, tag filter tooltip, conversation tooltip, iframe title, image alt) - **`persons/[id]/+page.svelte`** — `"wird gelöscht."` and `"Kein Datum"` replaced - **`admin/+page.svelte`** — `confirm()` dialog replaced with `m.admin_user_delete_confirm({ username })` - **`login/+page.svelte`** — DE/EN/ES language switcher added top-right (Option B), form labels wired to existing `login_*` keys Closes #12 ## Test plan - [ ] `npm run check` passes (0 errors) - [ ] Login page shows DE/EN/ES buttons top-right; clicking switches language and persists after login - [ ] Document detail page tooltips and labels translate correctly - [ ] Admin delete confirm dialog translates correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code)
marcel added 5 commits 2026-03-19 20:34:45 +01:00
- Add 9 missing translation keys to de/en/es.json:
  doc_file_error_preview, doc_download_title, doc_tag_filter_title,
  doc_conversation_title, doc_preview_iframe_title, doc_image_alt,
  doc_no_date, person_merge_will_be_deleted, admin_user_delete_confirm

- documents/[id]/+page.svelte: replace 6 hardcoded strings with m.*()
- persons/[id]/+page.svelte: replace "wird gelöscht." and "Kein Datum"
- admin/+page.svelte: replace confirm() string with m.admin_user_delete_confirm()
- login/+page.svelte: add top-right DE/EN/ES language switcher (Option B)
  and wire existing login_* keys to the form labels

Closes #12

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On first visit (no PARAGLIDE_LOCALE cookie), parse the Accept-Language
request header and set the cookie to the best matching supported locale
(de/en/es). The user's manual choice via the switcher always takes
precedence since the detection is skipped when the cookie exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract detectLocale() from hooks.server.ts into src/lib/server/locale.ts
so it can be tested in isolation. Add 7 unit tests covering:
- German, English, Spanish browser preferences
- Fallback when primary language is unsupported
- Quality value (q=) ordering
- Fully unsupported language → null
- Empty Accept-Language header → null

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add exact: true to all language button selectors in lang.spec.ts to
  prevent Playwright from matching "Abmelden" (contains "de") alongside
  the DE language button
- Fix goto in conversations applyFilters to use absolute path
  /conversations?... instead of relative ?... so URL updates correctly
- Set locale: 'de-DE' in playwright.config.ts so Accept-Language header
  is consistent and locale detection defaults to German during tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(e2e): fix locale cookie httpOnly and add hydration waits
Some checks failed
CI / Backend Unit Tests (pull_request) Has been cancelled
CI / E2E Tests (pull_request) Has been cancelled
CI / Unit & Component Tests (pull_request) Has been cancelled
CI / Unit & Component Tests (push) Successful in 2m3s
CI / Backend Unit Tests (push) Successful in 2m13s
CI / E2E Tests (push) Successful in 17m49s
fe9b4a9569
Paraglide's client-side setLocale writes the locale via document.cookie,
which silently fails for HttpOnly cookies. SvelteKit's cookies.set()
defaults to httpOnly: true, so locale switching never worked in tests.
Fix by setting httpOnly: false on the locale cookie (it's a UI preference,
not a credential — no security concern).

Add waitForSelector('[data-hydrated]') before any click that relies on
SvelteKit JavaScript event handlers. Without this, the click fires before
hydration and the onclick handler is not yet registered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marcel force-pushed feat/i18n-missing-strings from 60189d6672 to fe9b4a9569 2026-03-19 20:34:45 +01:00 Compare
marcel merged commit fe9b4a9569 into main 2026-03-19 21:04:06 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#16