Skip to content

docs(test): label locale snapshot baselines as layout probes, not translation checks - #1006

Merged
wei18 merged 1 commit into
mainfrom
docs/977-locale-baseline-labels
Aug 11, 2026
Merged

wei18 merged 1 commit into
mainfrom
docs/977-locale-baseline-labels

Conversation

@wei18

@wei18 wei18 commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Documentation only — no behaviour change, no baseline re-recorded.

Why

The snapshot harness injects .environment(\.locale, ...) and its doc comment presented that as the locale mechanism, unqualified. It is not one for strings. Text(LocalizedStringKey) resolves against Bundle.main, and in a headless swift test host Bundle.main is the xctest runner — which carries none of the App target's compiled .lproj resources. The string catalogs live at App/Sudoku/Resources/Localizable.xcstrings and App/Minesweeper/Resources/Localizable.xcstrings, inside the App targets; no Swift package owns them, and swift test never builds an App target. So UI strings stay English regardless of the injected locale. Only date/number formatting and layout direction respond.

That gap produced 108 byte-identical "localized" baselines in #976 (backed out) and contributed to two misdiagnoses. The three long-standing locale-tagged BoardView baselines (ja, ko, zh-TW) were always layout-robustness probes — nothing said so, so they read as translation coverage to anyone skimming.

What changed

  • SudokuUITests/SnapshotConfig.swift — the locale: parameter doc now states plainly what it does and does not do, with the Bundle.main reason. The second hostingView variant carries a one-line pointer.
  • MinesweeperUITests/SnapshotConfig.swift — same note at both .environment(\.locale, ...) sites (the file had no /// param docs to correct, so the note sits at the call site).
  • SudokuUITests/BoardViewTests.swift — file header and the three locale tests now say "layout probe" explicitly.

Both SnapshotConfig.swift and BoardViewTests.swift sit at exactly the SwiftLint file_length ceiling of 400, so these edits were written to land at 400, not 401. swiftlint --strict on all three files: 0 violations, 0 serious.

Scope

#977 stays open. Per the product decision on 2026-08-11 the store frames keep rendering English app UI beneath localized marketing captions, so the underlying fix is deferred, not attempted. This PR only stops the harness from misrepresenting what it does — it is the cheap part that was worth doing regardless of which fix is eventually chosen.

For the record, the evaluation behind that deferral: option (a) — threading a bundle through every localizing call site — measures 203 call sites across the four shared UI targets (GameShellUI 21, SudokuUI 73, MinesweeperUI 71, SettingsUI 38), with no chokepoint component to narrow it, and would still leave the test host without a compiled .lproj to point at. Option (b) — capturing from the Simulator — is structurally right but needs an iPad boot path, a brand-new macOS-native capture path, two new DEBUG route hooks, and a locale loop that does not exist yet.

part of #977

🤖 Generated with Claude Code

…nslation checks

The snapshot harness injects `.environment(\.locale, ...)`, which its doc
comment presented as the locale mechanism without qualification. It is not one
for strings: `Text(LocalizedStringKey)` resolves against `Bundle.main`, and in a
headless `swift test` host that is the xctest runner, which carries none of the
App target's compiled `.lproj` resources. UI strings therefore stay English no
matter which locale is injected — only date/number formatting and layout
direction respond.

That gap produced 108 byte-identical "localized" baselines in #976 (backed out)
and contributed to two misdiagnoses. The three long-standing locale-tagged
BoardView baselines (ja, ko, zh-TW) were always layout-robustness probes; nothing
said so, so they read as translation coverage.

This is documentation only — no behaviour change. #977 stays open as the record
of the underlying limitation; per the product decision on 2026-08-11 the store
frames keep rendering English app UI under localized marketing captions, so the
fix is deferred rather than attempted.

Both `hostingView` variants in each app's harness now carry the note, and the
BoardView call sites say "layout probe" explicitly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@wei18
wei18 merged commit 347fe3c into main Aug 11, 2026
5 checks passed
@wei18
wei18 deleted the docs/977-locale-baseline-labels branch August 11, 2026 11:32
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