Review by Claude Fable (model id claude-fable-5-2), read-only on 21b4b0f over main 2e21630.
Verdict: APPROVE
Diagnosis: right, confirmed by running it. On this Mac (macOS 27.0, Swift 6.4.2) I reflected the two keys:
LocalizedStringKey("docs.editor.toolbar.block.heading\(level)")gives keydocs.editor.toolbar.block.heading%lld,hasFormatting=true, one argument.LocalizedStringKey("docs.editor.toolbar.block.heading" + String(level))gives keydocs.editor.toolbar.block.heading2,hasFormatting=false, no arguments.
No table has "…heading%lld", so SwiftUI showed the key.
Fix: correct on macOS and iOS. LocalizedStringKey.init(_ value: String) with a non-literal String uses it verbatim as the key (even a % in it is not treated as a format). That is the same SwiftUI initialiser on both platforms, and the file already relies on it at lines 38, 45, 67 and 70. The call must never go back to a literal: a literal argument picks the interpolating initialiser. The helper and its comment cover that. I did not run it on an iOS device or simulator.
Other places with the same trap: none in Docs.
- I listed every interpolated string literal in
native/apple/Sources(51 lines) and read each one. All are URLs, cache paths, HTML, mark names, accessibility identifiers, diagnostics, orText(verbatim:). None reachesText,Label,Button,LocalizedStringKey,String(localized:),String.LocalizationValueorNSLocalizedString. - Every dynamic key is built by concatenation or passed as a String variable (
DocsEditorCommands.swift:40,DocsColophon.swift:88/92,EditorToolbar.swift:38/45), which is safe.DocsColophon.swift:85already carries a comment about this trap. native/iosand the tests have no hits either.- rastrillo/native at the pinned a18c32b has three interpolated
Text(…, bundle:)calls in RastrilloMacUpdates (NativeUpdateCommands.swift:29,NativeUpdateNotice.swift:29-30). These are deliberate formats: the en table has the matching%@keys, so they render properly.
Test: meaningful for what it claims, and only that.
- I ran it in a throwaway worktree: it passes. With ja's heading2 line deleted it fails with "ja: docs.editor.toolbar.block.heading2 has no translation". It walks all 12 lproj tables.
- It does not guard the trap itself, as the discussion already says. Reverting line 18 to the interpolated literal would leave it green.
Non-blocking suggestions
- A grep gate in
native/scripts/check-native.shwould guard the trap directly, failing onLocalizedStringKey("…\(and onText|Label|Button("…\(…", bundle:innative/apple/Sources. Today it would have zero hits. - The
value.contains("%")assertion adds little, since a heading label would never be a format; harmless. - Separate from this branch, in rastrillo: the three RastrilloMacUpdates format strings exist only in en. The other 11 languages show the English sentence ("Docs 0.1.9 is ready."), not a raw key. Worth a rastrillo task.