Files
claude-plugins/pdat-swift-practice/skills/apple-findings/references/localization.md
T
TomUviandClaude Opus 5 3ad73df76a Sweep the whole blog, not just the front page
153 posts under the SwiftUI tag, plus wwdc25 and wwdc26. Filtering them
against what our code actually contains turned up one real defect and a
short list worth keeping.

The defect is plurals. A checkout screen renders "\(count) coupons",
whose Czech translation is the single form "%lld kupónů" — so it says
"1 kupónů" and "3 kupónů", wrong for every count below five. The article
that surfaced it recommends inflect:, which covers English, Spanish and
six others but not Czech, the language that needs three forms rather than
two. Plural variations in the String Catalog are the fix for us; the
entry says so rather than repeating the article's advice.

Two entries are filed against a future rather than now: swipe action
buttons draw their titles from iOS 26, which will surprise us the day we
add a custom one, and a Form inside a sheet covers the glass behind it,
which starts to matter if the payment sheet ever gets a medium detent.

The rest is recorded as swept and skipped, with reasons — including that
Core Spotlight and the search tab are things we already do correctly, and
that three posts are covered better by the skills shipping inside Xcode.
A sweep that leaves no trace of what it rejected gets repeated.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 09:38:55 +02:00

2.0 KiB
Raw Blame History

Localization

Plurals: inflection is not enough for Czech

What it is. SwiftUI parses an inflection attribute inside a Text literal and applies Foundation's grammar agreement, so the noun follows the number without any manual branching:

Text("You read ^[\(bookCount) book](inflect: true) this year!")

Language support is the catch. It shipped for English and Spanish in iOS 15, and iOS 18 added German, French, Italian, Portuguese, Hindi and Korean. Czech is not on that list, and Czech is exactly the language that needs it: 1 kupón, 2–4 kupóny, 5+ kupónů — three forms where English has two.

What it found in our code. A real bug, not a nicety:

Text("\(activeCoupons.count) coupons")   // CardDetailView, checkout screen

The Czech translation in the catalogue is a single string, %lld kupónů, so the app renders "1 kupónů" and "3 kupónů" — wrong for every count except five and up. It sits on the checkout screen, which is the screen people actually look at in a shop.

The fix for us is plural variations in the String Catalog rather than inflect:. Xcode's "Vary by Plural" writes a variations.plural block with one / few / many / other, and Czech uses all of them:

category counts Czech
one 1 1 kupón
few 2–4 3 kupóny
many fractions 1,5 kupónu
other 0, 5+ 5 kupónů

Worth auditing every interpolated count in the UI at the same time; a count wrapped in parentheses — "Send unsent receipts (3)" — dodges the problem entirely and is a reasonable fallback where a plural form would be awkward.

Step forward? Yes, and overdue. This is the kind of defect that never shows up in a test and that a Czech speaker notices immediately.

Source. Natalia Panferova, "Handle plurals in SwiftUI Text views with inflection", nilcoalescing.com, 13 Jan 2025. Read 18 Aug 2026. The article is about inflect:; the Czech conclusion is ours, from checking which languages that API actually covers.