lens icon indicating copy to clipboard operation
lens copied to clipboard

Finish implementation of CLDR number formatting

Open syeopite opened this issue 4 years ago • 2 comments

The basic infrastructure for implementing number formatting was introduced in Lens with commit 5997047. Since then, almost all features needed to format a number has been added. In fact, the formatter is actually present and working:

In commit 7e2d9f1 of master, this code produces the expected output of 10,00,00,000.124

rules, metadata = CLDR::Numbers::PatternParser.new("#,##0.##").parse
formatter = CLDR::Numbers::PatternFormatter(CLDR::Languages::EN).new(rules, metadata)

formatter.format(1000.129) # => 1,000.13
formatter.format(-1000.129) # => -1,000.13

However, despite all this there's still quite a few crucial features missing.

  • [x] Explicit plus signs and negative patterns
  • [x] Prefixes
  • [x] Suffixes
  • [ ] Minimum grouping digits
  • [x] Significant digits
  • [ ] Scientific notations
  • [ ] Rounding
  • [ ] Padding
  • [ ] Currency symbols
  • [x] Fractional grouping

A better public API should then be constructed before we can push it out to version 0.2.

syeopite avatar Sep 01 '21 01:09 syeopite

Implemented parsing for significant figures, padding and fractional grouping in commit 46df2ab.

syeopite avatar Sep 19 '21 08:09 syeopite

Implemented parsing for subpattern and explicit plus-minus signs with commit ba67656e5281b069f04de985f5a42d47e7b47f7c

syeopite avatar Sep 30 '21 13:09 syeopite