Repository navigation
Sync chip: surface the strap backlog, with both counts inflected (#833) - #2138
Conversation
ryanbr#833 review) Rebuilt on current main rather than rebased: the chip has moved since the original branch (ryanbr#859 made its state resolvable without an Application, ryanbr#1472 changed the age token, ryanbr#1208 fixed its height), and the old diff no longer described the code it was patching. ## Plurals, the substantive half of the review "1 pages behind" was the reported defect, but the accessibility line carries TWO counts and Android <plurals> inflects one quantity per resource. So each count becomes its own <plurals> and the sentence becomes a template joining them. The joiner sits inside the template, never on a resource edge — aapt2 strips edge whitespace, which is what ryanbr#2041 had to clean up across 59 sites. That also fixes "1 chunks", which predates this change and was never right in any locale. Seven locales, not the five the original branch knew: pl and ru landed since July. Both take the CLDR four-form set; zh takes `other` alone. NOT verified by a native speaker — the forms follow CLDR and the existing plural entries in each file, and that is the extent of the claim. ## A zero backlog is dropped, not rendered "0 pages behind at connect" beside a spinning sync icon contradicts itself, and a zero sample gives a reader nothing to act on. The rule lives in `resolve` on both platforms so neither view layer decides it alone, and it is pinned by a test. ## The figure says "at connect", per the review's second point It is sampled once from the connect-time GET_DATA_RANGE reply and never re-polled (ryanbr#377), so a static number under a "syncing" label otherwise reads as a stalled live one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ead-out (ryanbr#833 review) Companion to the Android half in the previous commit, so the parity contract holds in one PR. The chunk phrase already had plural variations in 9 of 10 catalogue locales — pl was still a flat string and is now inflected like the rest. The backlog phrase is new, inflected across all ten, and a template joins the two so both counts read correctly and the joining punctuation stays inside the translated string. The template's wording is DERIVED from each locale's existing chunk translation rather than re-translated, so nothing already reviewed changes meaning. Where it surfaces differs by platform, deliberately. Android's chip is a capsule with room for a second text run, so the figure is visible there. Apple's is a spinner with the count inside it and no room for a phrase, so the figure lands in the accessibility read-out that already spoke the chunk count. Feature-level parity, not pixel parity. The zero rule and the "at connect" wording match the Kotlin twin exactly, and `resolve` applies the zero rule on both sides so neither view layer decides it alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks @digitalerdude. Reviewed on a checkout, and ran the two gates that CI does not. Your Swift tests DID run, and passedYou flagged them as unrun because your invocation swallowed the result. They ran in CI: So Ran here, because CI does not
The plural work holds upThe joiner is inside the template ( All eight files carry both plurals. On Fixing "1 chunks" while here is worth more than it sounds, given it was wrong in every locale. Two notes, neither blockingThe base is stale. This branch is on "at connect" is the right fix for the second review point. The figure comes from the connect-time Dropping a zero rather than rendering it, with the rule in |
Supersedes #833, which is why this is a new branch rather than a rebase. Addresses both review points from that PR.
The chip has moved since July — #859 made its state resolvable without an Application, #1472 changed the age token, #1208 its height — so the old diff no longer described the code it patched. Rebuilding on current
mainwas cheaper than replaying it, and the surrounding code had changed enough that the result is not the same patch.1. Plurals — the substantive half
"1 pages behind" was reported, but the accessibility line carries TWO counts, and Android
<plurals>inflects one quantity per resource. So each count gets its own<plurals>and a template joins them. The joiner lives inside the template, never on a resource edge — aapt2 strips edge whitespace, which is the trap #2041 had to clean up across 59 sites.That also fixes "1 chunks", which predates this change and was wrong in every locale.
Apple needed less than expected:
"Syncing strap history, %lld chunks"already had plural variations in 9 of 10 catalogue locales. Onlyplwas still flat, and it is now inflected like the rest. The template's wording is derived from each locale's existing chunk translation plus its joiner, so nothing already reviewed is re-translated.Seven Android locales, not the five the old branch knew:
plandrulanded since July.2. "at connect", per the second review point
The figure is sampled once from the connect-time GET_DATA_RANGE reply and never re-polled (#377), so a static number under a "syncing" label otherwise reads as a stalled live one. The copy now says which it is.
A zero backlog is dropped, not rendered
"0 pages behind at connect" beside a running sync contradicts itself, and a zero sample gives a reader nothing to act on. The rule lives in
resolveon both platforms so neither view layer decides it alone, and it is pinned by a test on each side.Where it surfaces differs by platform, deliberately
Android's chip is a capsule with room for a second text run, so the figure is visible there (
maxLines = 1+ ellipsis so a long localisation cannot push the header cluster off a narrow screen). Apple's is a spinner with the count inside it and no room for a phrase, so the figure lands in the accessibility read-out that already spoke the chunk count. Feature-level parity, not pixel parity.Verification
./gradlew compileFullDebugKotlin— BUILD SUCCESSFUL./gradlew testFullDebugUnitTest --tests "com.noop.ui.SyncChipStateTest"— BUILD SUCCESSFUL (4 new cases)xcodebuild … -scheme Strand -destination 'platform=macOS' build— BUILD SUCCEEDED. Worth noting the catalogue is genuinely checked by this: an earlier attempt failed here withMissing required key 'stringUnit'when a variations block was malformed, so a green build is real evidence about the strings and not only about the Swift.Tools/doc_comment_lint.py— OKNot established, and I would rather say so than imply otherwise:
xcodebuild … test, but my invocation filtered its own output and I did not capture a pass/fail line. Treat them as unrun until CI or someone else confirms them. The Kotlin twins did pass.plandruplural forms follow CLDR and the existing entries in each file. They are NOT native-speaker checked; that is the whole claim.