Repository navigation
Use pattern grouping sizes in format_decimal - #16
Merged
Merged
Conversation
format_decimal always grouped digits in threes, so Indian patterns like =#,##,##0= (Hindi, Tamil, Nepali, Chakma) printed 1,234,567 instead of 12,34,567. Derive the primary and secondary grouping sizes from the pattern, as ICU DecimalFormat does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #15.
What
format_decimalalways grouped digits in threes ("{:,}"), ignoring the grouping in the pattern. Now that=#,##,##0=replace rules go through it (#15), Indian-style patterns came out wrong:hidigits-ordinal-masculine12345671,234,567वाँ12,34,567वाँtadigits-ordinal12345671,234,567.12,34,567.hispellout-cardinal10**181,000,000,000,000,000,00010,00,00,00,00,00,00,00,000Affects Hindi, Tamil, Nepali and Chakma (
ccp).How
Read the primary grouping size (digits after the last comma) and the secondary size (digits between the last two commas, or the primary size if there is only one comma) from the pattern, as ICU DecimalFormat does.
#,##0→ (3, 3),#,##,##0→ (3, 2). Negative values keep their sign.Tests
format_decimaltests for Indian grouping, negatives, no grouping, and 1e18digits-ordinal-masculine1234567 →12,34,567वाँAlso adds an Unreleased changelog entry covering #15 and this change.
🤖 Generated with Claude Code