i18n: extract 3 StrandDesign a11y labels via existing translations (#920) - #1038
i18n: extract 3 StrandDesign a11y labels via existing translations (#920)#1038digitalerdude wants to merge 2 commits into
Conversation
…yanbr#920) Next day/Previous day (DayNavBar) and Trend (TrendChart) were unextracted literals in StrandDesign's catalog even though the exact same English key already has full de/es/fr/pt-PT (+it/ru/zh) translations in the Strand catalog. Copy those existing, already-reviewed values into StrandDesign's Localizable.xcstrings instead of inventing new ones. Scoped to the subset of ryanbr#920 that needs zero new translation: 3 of the 209 pending strings whose key already exists elsewhere, fully translated. The rest still needs real de/es/pt-PT input before it can pass the focus- locale gate, since the source (ryanbr#884) only supplies French. Removes the 3 corresponding entries from Tools/i18n_audit_baseline.json. i18n_extra_locale_baseline.txt untouched: all shipped non-focus locales (it/ru/zh-Hans/zh-Hant) were carried over too, so no allowance count grows.
|
The approach is right — reusing reviewed translations instead of generating new ones is exactly how to carve a shippable slice out of #920, and the audit accounting (baseline entries, extra-locale allowance untouched) is careful. But the three strings won't resolve from the catalog this adds them to, and for one of them the PR removes the only thing tracking a real gap. The catalog entries won't be consultedAll three call sites resolve against DayNavBar.swift:58 .accessibilityLabel("Previous day")
DayNavBar.swift:100 .accessibilityLabel("Next day")
TrendChart.swift:341 .accessibilityLabel(Text(accessibilityLabel ?? "Trend"))
The convention is already established in the same file — Text(label, bundle: .module)as does Two of them already work; the third cannot
So after this PR: two entries duplicate translations that nothing reads, and the third has its baseline entry removed while remaining genuinely un-localized. That is the part I'd push back on — the backlog stops tracking the one string that is actually broken. What would make it realThree call-site edits, and the catalog entries become the resolution source: // DayNavBar.swift
.accessibilityLabel(Text("Previous day", bundle: .module))
.accessibilityLabel(Text("Next day", bundle: .module))
// TrendChart.swift
.accessibilityLabel(accessibilityLabel.map(Text.init) ?? Text("Trend", bundle: .module))That also makes StrandDesign self-contained rather than borrowing its host app's catalog, which is the point of the audit rule the baseline was tracking. With those, the 162 added lines earn their keep and the baseline removals are honest. Worth knowing generally
|
…#920) The catalog entries added earlier don't resolve at runtime from these call sites: .accessibilityLabel(LocalizedStringKey) and Text(_:) look in Bundle.main, not StrandDesign's module bundle (Package.swift ships it via .process("Resources")). So Next day/Previous day only rendered localized because the host app's catalog happens to carry them, and Trend bound to the non-localizing Text(_ content: StringProtocol) initializer via the ?? String fallback — unlocalizable from any catalog without a code change. Route all three through the module bundle, matching the convention already used one line over (DayNavBar Text(label, bundle: .module)) and in Appearance.swift. This makes StrandDesign self-contained and makes the baseline removals honest — the strings are now both extracted and localized.
|
Confirmed all three, fixed in e5d4ac7 — the catalog half alone was resolving against Call sites now route through the module bundle, matching the convention one line over in // DayNavBar.swift
.accessibilityLabel(Text("Previous day", bundle: .module))
.accessibilityLabel(Text("Next day", bundle: .module))
// TrendChart.swift
.accessibilityLabel(accessibilityLabel.map(Text.init) ?? Text("Trend", bundle: .module))For Verified: |
Summary
Scoped subset of #920: 3 of the 209 pending strings whose exact English key already has full, reviewed translations elsewhere in the repo, so they can be extracted with zero new translation work.
Next day/Previous day(DayNavBar.swift) andTrend(TrendChart.swift) were unextracted literals in StrandDesign's catalog (accessibility labels).Strand/Resources/Localizable.xcstrings.localizationsblocks 1:1 intoPackages/StrandDesign/Sources/StrandDesign/Resources/Localizable.xcstrings— no invented or machine-translated values.Tools/i18n_audit_baseline.json.Tools/i18n_extra_locale_baseline.txtuntouched: all non-focus locales StrandDesign ships (it/ru/zh-Hans/zh-Hant) were carried over too, so the ratcheting allowance doesn't need to change.Why not the full 209 from #920/#884: the rest need real de/es/pt-PT translations before they can pass the focus-locale gate — the #884 attachment only supplies French. That's separate follow-up work, not something this PR attempts.
Cross-platform: no Android change — this is a StrandDesign accessibility-label catalog fix, not an analytics/schema/stored-value change, so the byte-parity contract doesn't apply here.
Test plan
python3 Tools/i18n_audit.py --ci HEAD→ exit 0, no FAIL, all four focus locales OK for the touched catalogpython3 Tools/test_i18n_audit.py→ 36 tests OKgit statustouches only the 2 intended files