One-line revert that realigns FootnoteAccessibility.inlinePhrase(for:) with the spec-prescribed String(localized:) form, restoring the macOS and iOS builds broken by PR #256.
String(localized:) with interpolation cannot take a defaultValue: argument.defaultValue:; rely on the existing a11y.footnote.inline %lld catalog entry which is translated for en, en-GB, and en-US.make build-macos, make build-ios, make lint, and the FootnoteAccessibilityTests suite all pass.Ready to push
Minimal mechanical revert. macOS build, iOS build, SwiftLint, and the existing FootnoteAccessibilityTests suite all pass. Implementation now matches specs/footnote-badge-a11y/implementation.md:141.
b881e94 [fix]: Restore macOS build after VoiceOver footnote merge String(localized:) has two flavours: one accepts an interpolated key (e.g. "... \(number)") and looks up the synthesised %lld entry in the string catalog; the other accepts a fixed key plus a defaultValue: fallback. They can't be combined.
The commit that added VoiceOver support for footnote badges tried to mix them, so the project stopped compiling on macOS and iOS. This fix removes the fallback argument and uses the interpolated form alone — which is what the spec already prescribed.
Swift resolves String(localized:) to a specific overload at compile time:
String.LocalizationValue supports interpolation (producing a %lld-formatted catalog key) but offers no defaultValue: parameter.StaticString + defaultValue: does support a fallback, but its key argument cannot be interpolated.The original author wanted both — interpolation and a "footnote N" safety net — which isn't available in any single overload. Since Localizable.xcstrings already has "a11y.footnote.inline %lld" translated for en, en-GB, and en-US, the fallback was redundant; dropping it matches the spec and restores compilation.
The interpolated overload's catalog-miss fallback formats the interpolation literal with the actual value, so a missing entry would render "a11y.footnote.inline 3" — ugly, but not crashy. The author tried to harden that fallback to "footnote N" but selected an incompatible overload, producing cannot convert value of type 'String' to expected argument type 'StaticString' at FootnoteAccessibility.swift:98.
Realistic risk of a catalog miss here is near zero (the entry has extractionState: manual and three English variants present), so the safety net costs more than it buys. If a hardened fallback is ever needed in the future, the right shape is String.localizedStringWithFormat(NSLocalizedString("a11y.footnote.inline %lld", value: "footnote %lld", comment: ""), displayNumber) — but that's over-engineered for this site.
FootnoteAccessibility.swift
Why it matters. Restores the macOS and iOS builds, both of which fail on origin/main at this call site.
What to look at. prism/Services/FootnoteAccessibility.swift:96-98
The original feature already has Decision 1 ("Rebuild paragraph accessibility label in Prism, not in the Textual fork") capturing the architectural choice. This fix doesn't make a new decision — it reverts a code-level deviation from the prescribed call form. No decision log update warranted.
Click to expand.
diff --git a/prism/Services/FootnoteAccessibility.swift b/prism/Services/FootnoteAccessibility.swift
index fc5ce2c..683d459 100644
--- a/prism/Services/FootnoteAccessibility.swift
+++ b/prism/Services/FootnoteAccessibility.swift
@@ -89,14 +89,7 @@ enum FootnoteAccessibility {
}
/// Localised inline phrase for a footnote with the given display number.
- ///
- /// `defaultValue:` guards against a catalog lookup gap (missing locale,
- /// future key rename) so VoiceOver falls back to "footnote N" instead of
- /// announcing the raw key string.
private static func inlinePhrase(for displayNumber: Int) -> String {
- String(
- localized: "a11y.footnote.inline \(displayNumber)",
- defaultValue: "footnote \(displayNumber)"
- )
+ String(localized: "a11y.footnote.inline \(displayNumber)")
}
}
If Localizable.xcstrings ever loses the a11y.footnote.inline %lld entry, VoiceOver will narrate "a11y.footnote.inline 3" instead of "footnote 3". The build script Tools/validate-localisation.py should catch a regression there, but worth keeping in mind if the key is ever renamed.