Repository navigation
fix(l10n): localize loader failed-state titles in both apps - #859
Merged
Merged
Conversation
MinesweeperBoardLoaderView and MinesweeperDailyReplayLoaderView both render "Couldn't load saved game." in their .failed block, but the key was absent from Minesweeper's Localizable.xcstrings — non-English users saw English. Added the key ×7 locales to App/Minesweeper/Resources/Localizable.xcstrings. Auditing Sudoku's BoardLoaderView (the mirrored surface) turned up the same gap with different copy: "Couldn't load puzzle." was also missing from Sudoku's catalog. Added the key ×7 locales to App/Sudoku/Resources/Localizable.xcstrings. Close/Retry button labels in all three loader failed-state views were already catalog keys in both apps — no gap there. Both strings are per-app (different literal text, not shared copy), so each key lives only in its own app's catalog, following the existing convention (e.g. "Couldn't load leaderboard." is duplicated across apps only because the literal text is identical in both). Regenerated the SudokuAppCompositionTests fixture via gen:l10n_fixture to keep it byte-synced. The scanner's source-literal blindspot (scan:l10n validates catalog completeness, not source-string coverage — this exact gap type would recur silently) remains an open follow-up per the issue's "bigger question"; not addressed here. Closes #854 Co-Authored-By: Claude Fable 5 <[email protected]>
wei18
enabled auto-merge (squash)
July 17, 2026 08:23
wei18
added a commit
that referenced
this pull request
Jul 17, 2026
…oku (#868) Sudoku's board toolbar always showed "Pause" (bars icon), even before any digit was placed, even though tapping it only ever opened the "Leave Game?" sheet — no real pause feature exists yet. Minesweeper's equivalent control was already state-aware: "Leave" + X pre-first-reveal, "Pause" + bars once playing. Per #849 adjudication, extract the shared state→label/icon mapping into `BoardLeaveOrPauseState` / `BoardLeaveOrPauseButton` (GameShellUI, zero deps) and have both board views derive their own Ready-state signal from it. Sudoku has no `.idle` board render (`startOrResume()` fires during `BoardLoaderView`, before the toolbar ever mounts), so its semantically equivalent Ready signal is "no move made yet on a live session" — `status == .playing && !canUndo` (`canUndo` mirrors the session's undo stack, which only digit placement/erase populates, never pencil notes). Both apps gained a small view-local `showReadyLeaveOverlay` / `showIdleLeaveOverlay` flag so tapping Leave-ready opens the shared "Leave Game?" sheet without an illegal pause transition; Resume just hides the flag. Sheet behavior itself is unchanged. No new localized strings: `leave.game.leave`, `Pause`, `Resume` already carry all 7 locales in both catalogs. Snapshot churn (17 baselines, all reviewed as legitimate): - 7 fresh/no-move-yet boards now show Leave+X instead of Pause+bars (the intended #849 fix): BoardViewBannerTests ads-enabled iPhone light/dark, BoardViewTests empty iPhone light/dark-ja/Mac light/dark, BoardViewPencilNotesTests (notes-only boards have no digit-undo history). - 10 fixtures with placed digits (InProgress ×5, AlmostComplete ×4, ArmedDigit ×1) needed their `canUndo` fixture value corrected to match their visible board content (previously always false regardless of placed digits) — toolbar itself is pixel-identical (stays Pause), the Undo/Redo buttons flip from incorrectly-disabled to correctly-enabled. Rebased onto ecea204 (#859/#860/#862): #860's DigitPadView contrast/a11y rewrite re-recorded 8 of the same iPhone-compact baselines this change touches. Took upstream as the merge base for the 8 PNG conflicts, then re-recorded on the fully rebased tree so each baseline reflects the union of both changes (verified pixel-diffed, e.g. the empty-board banner fixture now shows both this fix's Leave/X toolbar and #860's digit-pad ink fix in one frame). No source conflicts — #862's `BoardView+Completion.swift` / `BoardLoaderView.swift` changes didn't touch the lines this PR edits. CR round 2 (3 findings, all addressed): Finding 1 (clock-model honesty): the original comment claimed straight MS parity, but Sudoku's clock starts at `GameSession.start()` — called by `BoardLoaderView` before the toolbar ever mounts — while MS's clock starts only on first reveal/flag. Empirically verified (`GameSessionElapsedTests .startAtZero`, SudokuCoreKit, plus a new live-session test here) that `elapsedSeconds == 0` IS the real state at the instant `startOrResume()` returns, so the Ready window is reachable — just far narrower than MS's: gated `.leaveReady` on `elapsedSeconds == 0 && !canUndo` (was `!canUndo` alone), and rewrote the code comment to state the clock-model asymmetry plainly instead of claiming parity. This also fixes the real bug the finding flagged: a pencil-marking player (`toggleNote` never touches `undoStack`) or anyone who's simply let a second tick by now correctly sees Pause, not Leave, once the clock has genuinely started accruing time. Verified pause-overlay shape parity separately: both apps mount the exact same shared `PauseOverlayView` with identical default strings (`leave.game.title` "Leave Game?" / `leave.game.leave` "Leave") for a genuine pause AND the Ready-state Leave-confirm — this is pre-existing, shared, cross-app behavior, not something #849 introduced, so no shape change was needed. Finding 2 (resume-mount race): `BoardLoaderView.mountLoaded` renders `BoardView` (`state = .loaded(viewModel)`) before `await viewModel.startOrResume()`'s resync lands, so a resumed mid-game `GameViewModel` could momentarily read the constructor's default `canUndo == false` and flash `.leaveReady` for one frame. Added `initialCanUndo` to the live `GameViewModel` init and threaded `!snapshot.undoMoves.isEmpty` through at construction in `BoardLoaderView.mountLoaded` — no transient wrong label. Finding 3 (fixture fidelity): `BoardViewTests.makeViewModel`'s `canUndo` derivation (`!userCells.isEmpty || elapsedSeconds > 0`) couldn't express the pencil-only/running-clock scenario Finding 1 fixes, and wasn't faithful to production's `!undoStack.isEmpty`. Changed the default to `!userCells.isEmpty` alone (elapsedSeconds decoupled), with an explicit `canUndo` override where the two must diverge (the `almostCompleteClues` fixtures encode their near-solved state as puzzle givens, not `userCells`). Added test coverage in `BoardLeaveOrPauseStateTests` pinning: a running clock with no move made (pencil-only) resolves to `.pause`; a running clock with a move resolves to `.pause`; the live-session Ready window is reachable; and a resumed construction with `initialCanUndo` has no transient `.leaveReady`. One additional legitimate re-record from this round: BoardViewPencilNotesTests now correctly shows Pause (was incorrectly showing Leave under the old canUndo-only gate, since a pencil-only board has real elapsed time but no undo history — exactly Finding 1's motivating bug). Closes #849 Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #854 — loader .failed titles rendered untranslated English. Adds "Couldn't load saved game." (MS catalog, both MS loaders) and "Couldn't load puzzle." (Sudoku catalog — the issue's literal instruction named the MS string for both apps, but Sudoku's BoardLoaderView actually renders different copy; following the source, not the issue text, and disclosed) ×7 locales. Close/Retry + error-body keys verified pre-existing. Catalog-only diff (+144), fixture regenerated.
Review
Dual review (>50 LOC rule): mechanical checks folded into the adversarial pass — APPROVE: byte-identical key↔source match on all 3 call sites (Text("literal") localizes; no verbatim/interpolation), translation terminology cross-checked against neighboring entries (es 'puzle' consistent across 8 existing keys), pure-additive splice (0 deletions), per-app placement per convention. Scanner source-literal blindspot stays open as noted in the commit.
Verification
scan:l10n green ×2 · SudokuKit Board 65/65 · MinesweeperKit 335/335 --no-parallel · gitleaks clean.
🤖 Generated with Claude Code