Skip to content

Conversation

@wakabayashi1211
Copy link

@wakabayashi1211 wakabayashi1211 commented Jan 15, 2026

What

Not compact and use default format when pattern value is "0".

Why

It is specified in LDML.

https://unicode.org/reports/tr35/tr35-numbers.html

If the value is precisely “0”, either explicit or defaulted, then the normal number format pattern for that sort of object is supplied — either or — with the normal formatting for the locale (such as the grouping separators). However, for the “0” case by default the significant digits are adjusted for consistency, typically to 2 or 3 digits, and the maximum fractional digits are set to 0 (for both currencies and plain decimal). Thus the output would be $12, not $12.01. APIs may, however, allow these default behaviors to be overridden.

For now, strange conversion occurs. At least in Japanese, it is not correct.

wakabayashi1211@P2474 twitter-cldr-rb % bundle exec irb
irb(main):001> require 'twitter_cldr'
=> true
irb(main):002> TwitterCldr::Localized::LocalizedNumber.new(9876, :ja).to_s(format: :short)
=> "10"
irb(main):003> 

Anything else

I have two questions.

  • Is this expected behavior? If so, we should change only Japanese format (I'm afraid I'm not very knowledgeable about other languages).
  • If this behavior should be fixed, how should we handle decimal parts?

@CLAassistant
Copy link

CLAassistant commented Jan 15, 2026

CLA assistant check
All committers have signed the CLA.

@wakabayashi1211
Copy link
Author

@camertron
Can you check this?
I wonder if this is intentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants