Files
2026-02-18 01:31:41 +01:00

126 lines
5.0 KiB
Markdown

---
phase: 14-translation-polish-testing
plan: 01
subsystem: testing, i18n
tags: [vitest, i18n, polish, pluralization, coverage]
# Dependency graph
requires:
- phase: 13-domain-ui-migration
provides: Complete Polish translation files (en.json, pl.json with 1858 keys)
provides:
- Vitest unit testing infrastructure for Vue app
- i18n coverage report script (identifies untranslated strings)
- Polish pluralization unit tests (58 test cases)
- Translation review document (1858 keys in side-by-side format)
affects: [14-02 translation fixes, future i18n work]
# Tech tracking
tech-stack:
added: [vitest]
patterns: [unit testing for pure functions, i18n coverage reporting]
key-files:
created:
- vue-queststream-app/vitest.config.ts
- vue-queststream-app/scripts/i18n-coverage.ts
- vue-queststream-app/scripts/generate-translation-review.ts
- vue-queststream-app/tests/i18n/polish-pluralization.test.ts
- .planning/phases/14-translation-polish-testing/14-TRANSLATION-REVIEW.md
modified:
- vue-queststream-app/package.json
- vue-queststream-app/i18n/i18n.config.ts
key-decisions:
- "Fixed pluralization bug: now handles 111, 112, etc. correctly (uses % 100 for teen detection)"
- "Coverage script exit code 1 for critical issues (missing keys, plural mismatches)"
- "Vitest with node environment for pure function tests (no DOM needed)"
patterns-established:
- "Unit test pattern: tests/[domain]/[feature].test.ts"
- "Coverage script pattern: scripts/i18n-coverage.ts"
- "Translation review workflow: generate markdown for human audit"
# Metrics
duration: 12min
completed: 2026-01-29
---
# Phase 14 Plan 01: Translation Coverage Tooling Summary
**Vitest with 58 Polish pluralization tests, i18n coverage script identifying 167 untranslated strings and 6 plural issues, and 2162-line translation review document**
## Performance
- **Duration:** 12 min
- **Started:** 2026-01-29T19:25:00Z
- **Completed:** 2026-01-29T19:37:00Z
- **Tasks:** 3
- **Files modified:** 7
## Accomplishments
- Installed Vitest and configured for unit testing
- Created i18n coverage report script that identifies untranslated strings and plural form mismatches
- Created comprehensive Polish pluralization unit tests (58 test cases covering all CLDR forms)
- Fixed bug in pluralization: now correctly handles 111, 112, etc. as "many" form
- Generated 14-TRANSLATION-REVIEW.md with all 1858 translations in side-by-side format
## Task Commits
Each task was committed atomically:
1. **Task 1: Install Vitest and create coverage script** - `bb8c70e` (chore)
- vue-queststream-app submodule
2. **Task 2: Create Polish pluralization unit tests** - `3f27891` (test)
- Includes bugfix for i18n.config.ts pluralization function
3. **Task 3: Generate translation review file** - `2f2a1fb` + `f6a492c`
- Generation script in submodule, review file in main repo
## Files Created/Modified
- `vue-queststream-app/vitest.config.ts` - Vitest configuration (node environment)
- `vue-queststream-app/scripts/i18n-coverage.ts` - Coverage report script (149 lines)
- `vue-queststream-app/scripts/generate-translation-review.ts` - Review generator (373 lines)
- `vue-queststream-app/tests/i18n/polish-pluralization.test.ts` - Unit tests (194 lines)
- `vue-queststream-app/package.json` - Added test and test:watch scripts
- `vue-queststream-app/i18n/i18n.config.ts` - Fixed pluralization bug
- `.planning/phases/14-translation-polish-testing/14-TRANSLATION-REVIEW.md` - Review doc (2162 lines)
## Decisions Made
- Used Vitest with node environment (no DOM needed for pure function tests)
- Coverage script uses exclusion list for intentionally-same strings (QuestStream, XP, PIN, etc.)
- Exit code 1 for critical issues (missing keys, plural mismatches) - suitable for CI
- Translation review organized by category for easier human audit
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Fixed Polish pluralization for numbers 111-119, 211-219, etc.**
- **Found during:** Task 2 (Polish pluralization unit tests)
- **Issue:** Pluralization function used `choice > 10 && choice < 20` which only catches 11-19, not 111-119
- **Fix:** Changed to `const lastTwoDigits = choice % 100; const teen = lastTwoDigits > 10 && lastTwoDigits < 20`
- **Files modified:** vue-queststream-app/i18n/i18n.config.ts
- **Verification:** All 58 unit tests pass including edge cases for 111, 112, 1011
- **Committed in:** 3f27891 (Task 2 commit)
---
**Total deviations:** 1 auto-fixed (Rule 1 - Bug)
**Impact on plan:** Bug fix essential for correct Polish grammar. Tests discovered the bug as intended.
## Issues Encountered
- pnpm store permissions issue - resolved by fixing ownership of /media/nvme/.pnpm-store/
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Coverage tooling ready for translation fix workflow (Plan 14-02)
- 167 potentially untranslated strings identified for review
- 6 plural form issues need fixing in pl.json
- Review document ready for human audit
---
*Phase: 14-translation-polish-testing*
*Completed: 2026-01-29*