docs(12-01): complete browser language auto-detection and port autofill test fix
- SUMMARY.md created with TDD execution details and test results - STATE.md updated with decisions and session info - ROADMAP.md updated: Phase 12 now shows 1/2 summaries (In Progress)
This commit is contained in:
@@ -115,7 +115,7 @@ Full details: [`milestones/v1.0-ROADMAP.md`](milestones/v1.0-ROADMAP.md)
|
||||
**Goal:** All hardcoded UI strings in every template respond to the FR/EN language toggle; browser language auto-detected from navigator.language on first visit; E2E suite fully green.
|
||||
**Requirements**: TBD
|
||||
**Depends on:** Phase 11
|
||||
**Plans:** 2 plans
|
||||
**Plans:** 1/2 plans executed
|
||||
|
||||
Plans:
|
||||
- [ ] 12-01-PLAN.md — Browser language auto-detection (navigator.language fallback) + fix test_port_autofill E2E
|
||||
|
||||
+25
-2
@@ -4,6 +4,22 @@ milestone: v1.1
|
||||
milestone_name: Hardening & Validation
|
||||
current_plan: 3
|
||||
status: verifying
|
||||
stopped_at: Completed 12-i18n-bugfixes/12-01-PLAN.md
|
||||
last_updated: "2026-04-15T13:45:02.158Z"
|
||||
last_activity: 2026-04-15
|
||||
progress:
|
||||
total_phases: 5
|
||||
completed_phases: 4
|
||||
total_plans: 20
|
||||
completed_plans: 19
|
||||
---
|
||||
|
||||
---
|
||||
gsd_state_version: 1.0
|
||||
milestone: v1.1
|
||||
milestone_name: Hardening & Validation
|
||||
current_plan: 3
|
||||
status: Phase complete — ready for verification
|
||||
stopped_at: Completed 11-ui-enhancements/11-04-PLAN.md
|
||||
last_updated: "2026-04-15T13:08:42.940Z"
|
||||
last_activity: 2026-04-15
|
||||
@@ -61,6 +77,11 @@ Last activity: 2026-04-15
|
||||
- Phase 9: UX Tech Debt Closure (UX-01..03) — must land before rollout
|
||||
- Phase 10: Real-World Runtime Validation (RTVAL-01..05) — must pass before rollout
|
||||
- Phase 11: UI Enhancements (UIE-01..05) — printer edit, separated form/list, client nav, theme toggle, i18n FR/EN
|
||||
- Phase 12: i18n bugfixes — full translation coverage + browser language auto-detection
|
||||
|
||||
### Roadmap Evolution
|
||||
|
||||
- Phase 12 added: i18n bugfixes — untranslated buttons/labels found post-Phase 11; browser language setting not honoured
|
||||
|
||||
### Open Concerns (now owned by v1.1 phases)
|
||||
|
||||
@@ -107,6 +128,8 @@ Full decision log in PROJECT.md Key Decisions table. Milestone v1.0 decisions ar
|
||||
- [Phase 11-ui-enhancements]: 11-01: driver_data context kept in GET /printers handler for future Plan 02 edit modal
|
||||
- [Phase 11-ui-enhancements]: 11-04: client_id extracted from printers[0].client_id in Jinja2 — no grouped structure change needed
|
||||
- [Phase 11-ui-enhancements]: 11-04: Unassigned group header plain text — group_client_id is None when client_id absent; no dead anchor
|
||||
- [Phase 12-i18n-bugfixes]: IIFE pattern chosen for Alpine store lang init — evaluates at store creation time (inside alpine:init), before any hydration
|
||||
- [Phase 12-i18n-bugfixes]: playwright browser.new_context(locale=...) used for navigator.language tests — isolates locale per test without global fixture contamination
|
||||
|
||||
### Active Blockers
|
||||
|
||||
@@ -120,6 +143,6 @@ None. BLOCKER-01 resolved 2026-04-13 via commits 74535ea (HMAC over IV+ciphertex
|
||||
|
||||
## Session Continuity
|
||||
|
||||
Last session: 2026-04-15T12:54:00.369Z
|
||||
Stopped at: Completed 11-ui-enhancements/11-04-PLAN.md
|
||||
Last session: 2026-04-15T13:45:02.151Z
|
||||
Stopped at: Completed 12-i18n-bugfixes/12-01-PLAN.md
|
||||
Resume file: None
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
phase: 12-i18n-bugfixes
|
||||
plan: "01"
|
||||
subsystem: frontend/i18n
|
||||
tags: [i18n, alpine, e2e, browser-language, tdd]
|
||||
dependency_graph:
|
||||
requires: [11-ui-enhancements/11-03]
|
||||
provides: [navigator.language-fallback, test_port_autofill-green]
|
||||
affects: [imptune/templates/base.html, tests/e2e/test_i18n_toggle.py, tests/e2e/test_port_autofill.py]
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns: [IIFE-in-Alpine-store, playwright-browser-context-locale]
|
||||
key_files:
|
||||
created: []
|
||||
modified:
|
||||
- imptune/templates/base.html
|
||||
- tests/e2e/test_i18n_toggle.py
|
||||
- tests/e2e/test_port_autofill.py
|
||||
decisions:
|
||||
- IIFE pattern chosen over lazy property for Alpine store lang init — evaluates at store creation time (inside alpine:init), not at hydration time
|
||||
- playwright browser.new_context(locale=...) used to override navigator.language per test — avoids global page fixture contamination
|
||||
metrics:
|
||||
duration: "~3 minutes"
|
||||
completed: "2026-04-15"
|
||||
tasks: 2
|
||||
files_modified: 3
|
||||
---
|
||||
|
||||
# Phase 12 Plan 01: i18n Bugfixes Summary
|
||||
|
||||
**One-liner:** IIFE-based navigator.language fallback in Alpine i18n store, plus test_port_autofill URL fix for /printers/new route.
|
||||
|
||||
## What Was Built
|
||||
|
||||
### Task 1: Browser language auto-detection in i18n store
|
||||
|
||||
Updated `imptune/templates/base.html` Alpine i18n store to replace the hardcoded `'fr'` default with an IIFE that:
|
||||
1. Checks `localStorage.getItem('imptune_lang')` — returns the saved preference if present
|
||||
2. Falls back to `navigator.language.startsWith('en') ? 'en' : 'fr'` if no saved preference
|
||||
|
||||
Added 3 new E2E tests to `tests/e2e/test_i18n_toggle.py` covering:
|
||||
- `test_navigator_language_en_sets_lang_en`: locale=en-US + empty localStorage → lang='en'
|
||||
- `test_navigator_language_fr_sets_lang_fr`: locale=fr-FR + empty localStorage → lang='fr'
|
||||
- `test_localstorage_wins_over_navigator_language`: locale=en-US + localStorage='fr' → lang='fr'
|
||||
|
||||
### Task 2: Fix test_port_autofill navigating to /printers/new
|
||||
|
||||
Updated `tests/e2e/test_port_autofill.py` to navigate to `/printers/new` instead of `/printers`. Plan 11-01 moved the add-printer form to the new route; the test was deferred in `deferred-items.md` and fixed here as planned.
|
||||
|
||||
## Test Results
|
||||
|
||||
- E2E suite: 10/10 passed (was 6/7 before this plan — `test_port_autofill` was failing)
|
||||
- Non-E2E suite: 122/122 passed (no regressions)
|
||||
|
||||
## Commits
|
||||
|
||||
| Hash | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| 86637f8 | test | add failing tests for navigator.language auto-detection (TDD RED) |
|
||||
| 5a02f4c | feat | update i18n store lang init to use navigator.language fallback (TDD GREEN) |
|
||||
| 2ab53f6 | fix | update test_port_autofill to navigate to /printers/new |
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
None — plan executed exactly as written.
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
- [x] `imptune/templates/base.html` — modified with IIFE navigator.language fallback
|
||||
- [x] `tests/e2e/test_i18n_toggle.py` — 3 new tests added, all pass
|
||||
- [x] `tests/e2e/test_port_autofill.py` — URL fixed to /printers/new, test passes
|
||||
- [x] Commits 86637f8, 5a02f4c, 2ab53f6 verified in git log
|
||||
- [x] E2E suite: 10 passed
|
||||
- [x] Non-E2E suite: 122 passed
|
||||
Reference in New Issue
Block a user