Skip to content

fix(l10n): route MS board status/context-menu strings through the catalog - #756

Merged
wei18 merged 1 commit into
mainfrom
fix/741-ms-board-l10n
Jul 10, 2026
Merged

wei18 merged 1 commit into
mainfrom
fix/741-ms-board-l10n

Conversation

@wei18

@wei18 wei18 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

What

Routes the MS board's remaining bare-literal strings through the l10n catalog (issue #741, same bug class as #731):

Sweep boundary: the "Row R, Column C" coordinate accessibilityLabel is deliberately left — Sudoku's BoardCellView has the identical unlocalized pattern, so it needs a cross-app fix per the mirror principle → filed as #755.

Part of #741 — resolves the two sites the issue names plus one swept site.

Verification

  • mise run scan:l10n → all 2 catalogs, 0 placeholders, all 7 locales complete (also independently re-run by review).
  • swift test --package-path Packages/MinesweeperKit --filter MinesweeperUITests → 197/197 passed; all board/completion snapshot PNGs byte-identical (en renderings unchanged).
  • swiftlint --strict on changed files → clean.
  • Dual code review: both APPROVE, zero findings; String(localized:bundle:.main) verified byte-identical to the chore(l10n): MS board control strings are plain English, not in the catalog #731 pattern; zh-Hant renderings verified natural in game context.

🤖 Generated with Claude Code

…alog

Same bug class as #731: a ternary/switch expression returning a plain
`String` feeds `Text`/`Button`/`Label`, which resolves via the verbatim
(non-localizing) initializer instead of the `LocalizedStringKey` literal
path — so the value never reaches the catalog even when Xcode has an
entry with that exact key.

Fixed sites:
- MinesweeperCellButton: macOS context-menu Flag/Unflag title and its
  VoiceOver action name (now a shared `flagToggleTitle`, reusing #731's
  "Flag" key; new "Unflag" key).
- MinesweeperCellButton: the per-cell `stateDescription` switch feeding
  `accessibilityLabel` (Hidden/Flagged/Mine/Empty — 4 new keys). Found in
  the board-surface sweep: same bug class, same file already being fixed.
- MinesweeperBoardView: `statusText` switch (Ready/Playing/Paused reuse
  none, new keys; You won/Boom reuse #421's Completion-screen keys) and
  the pause-toggle Label/accessibility title (Resume/Pause, reusing
  #434's toolbar-toggle keys).

All new/reused keys got the 7-locale AI-translated fan-out (en source,
zh-Hant primary) per the ai-translated-localization skill. `scan:l10n`
passes; full `MinesweeperUITests` suite (197 tests, including every
board/completion/terminal-overlay snapshot) passes with byte-identical
PNGs, confirming the en-rendered text is unchanged.

Deliberately left alone: `MinesweeperCellButton.accessibilityLabel`'s
"Row R, Column C" location string is plain interpolation (not a
ternary/switch literal) and mirrors an identical unlocalized pattern in
Sudoku's `BoardCellView` — fixing only MS here would violate the mirror
principle; it needs its own cross-app issue.

part of #741

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 10, 2026 18:07
@wei18
wei18 merged commit e279e23 into main Jul 10, 2026
4 checks passed
@wei18
wei18 deleted the fix/741-ms-board-l10n branch July 10, 2026 18:08
wei18 added a commit that referenced this pull request Jul 11, 2026
Records the #741 board-l10n fix (PR #756, sweep boundary -> #755), the
#747 acknowledgements follow-ups (PR #759, item-2 owner ruling, the
LicensePlist exclude schema trap, the resolve-drift review catch and the
#758 withdrawal), and the open-queue deltas.

Co-authored-by: Claude Fable 5 <[email protected]>
wei18 added a commit that referenced this pull request Jul 11, 2026
…h apps (#776)

MinesweeperCellButton and Sudoku's BoardCellView both built the per-cell
VoiceOver location prefix via plain string interpolation
("Row \(row + 1), Column \(column + 1)"), bypassing the catalog — so VO
read English coordinates in all non-en locales. Same #741 finding family,
different mechanism (interpolation instead of ternary/switch literals);
#756 deliberately left it for a cross-app pass per the mirror principle.

Both sites now route through String(localized:bundle:), producing one
shared format key "Row %lld, Column %lld" added to BOTH app catalogs
x 7 locales (zh-Hant uses Taiwan grid terms 列/欄; zh-Hans uses Mainland
行/列). The SudokuAppCompositionTests fixture was regenerated via
mise run gen:l10n_fixture (never hand-edited).

Out of scope, tracked separately: Sudoku's conflict/given/value/Empty
state suffixes in the same accessibilityLabel remain unlocalized (#771).

Verification: scan:l10n passes (2 catalogs, 7 locales complete);
MinesweeperKit full suite 232 tests pass; SudokuKit BoardViewTests 18/18
pass with byte-identical snapshot PNGs (en-rendered text unchanged).
Note: BoardViewTests' label assertions compare against the test's own
English re-implementation of the format (labelFor(cell:)), so they do
not exercise the catalog routing; the routed path is covered by the
compiler-generated key matching the catalog entry (same mechanism as
the pre-existing "Digit %lld" key). swiftlint --strict: 0 violations
on changed files.

Closes #755

Co-authored-by: Claude Fable 5 <[email protected]>
wei18 added a commit that referenced this pull request Jul 11, 2026
…777)

Sudoku's BoardCellView composed its per-cell VoiceOver state suffix via
plain interpolation — "conflict \(digit)", "given \(digit)",
"value \(digit)", "Empty" — bypassing the catalog, so VO read English
state words in all non-en locales. This is the Sudoku half of the bug
class #756 fixed on the Minesweeper side (stateDescription switch); #755
fixed the shared Row/Column prefix and left these for their own pass.

All four suffixes now route through String(localized:bundle:). Four keys
added to the Sudoku catalog only (conflict/given/value are Sudoku-
specific; MS has its own state keys since #756) x 7 locales; "Empty"
reuses the MS catalog's translations verbatim for cross-app consistency.
Fixture regenerated via mise run gen:l10n_fixture.

Also cleans up the two E2E header comments that claimed locale-
independent element queries (comment-only, no query changes):
MinesweeperE2ETests' full-label query tokens have been catalog-routed
since #741/#755, and SudokuE2ETests' digit-pad ("Digit %lld") and
"Empty" queries are catalog-routed too — all now documented as valid
under the simulator's default en locale only.

Verification: scan:l10n passes (2 catalogs, 7 locales complete);
SudokuKit builds clean; BoardViewTests 18/18 pass with byte-identical
snapshot PNGs (en rendering unchanged; the assertions compare against
the test's own English format re-implementation, so catalog routing is
covered by the compiler-generated keys matching the catalog entries,
same mechanism as "Digit %lld"); swiftlint --strict 0 violations on
the 3 changed Swift files.

Closes #771

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant