feat: validated native currency and percent formatting - #5
Merged
Conversation
Validated successor to #4, originally contributed by @Amanfromearth. Adds the Intl-shaped format contract, native iOS/Android formatting, currency/percent transitions, format retarget handling, regression coverage, and the FormatLab validation harness.
AmatoGiulio
force-pushed
the
feat/validated-currency-formatting
branch
from
August 17, 2026 09:37
fa242e5 to
d742335
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validated successor to #4, originally contributed by @Amanfromearth.
This keeps the core API direction from #4 — one
Intl.NumberFormatOptions-shapedformatobject plus thecurrencyshorthand — but incorporates the native-motion and lifecycle work required to make formatted transitions hold up against the SwiftUI reference instead of only formatting the right string.Public contract
format.style:decimal | currency | percentcurrencyshorthandcurrencyDisplay:symbol | codecurrencySign:standard | accounting(accountingis symbol-only)valueis unchangedaccessibilityLabelcurrencyDisplay: 'name'andtrailingDecimalSeparatorfrom the original proposal are deliberately deferred rather than exposed as partially validated contracts.Native implementation
iOS
Uses the real SwiftUI
.contentTransition(.numericText()), with the animation trigger bound to the rendered formatted text so format-only changes participate in the native transition.Android
No validated first-release motion constants were retuned as part of the structural fixes.
Validation
The example includes
FormatLab.tsxas a deterministic validation harness while the public example entrypoint remains the normalShowcase.The final 29-step currency/format GT covers USD symbol/code, format-only symbol↔code at the same value, EUR suffix, PAB punctuation, AED RTL + burst, accounting, repeated USD-code sign reversals, percent, JPY and BHD.
Validated during the review work:
yarn checkyarn preparenpm pack --dry-runThe integration branch is a single clean commit over
main; the long-livedfix/pr4-format-contractbranch remains available as the validation/audit trail. The contributor's originalupstream/intl-formattingbranch was not modified.