lens
lens copied to clipboard
Finish implementation of CLDR number formatting
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.
Implemented parsing for significant figures, padding and fractional grouping in commit 46df2ab.
Implemented parsing for subpattern and explicit plus-minus signs with commit ba67656e5281b069f04de985f5a42d47e7b47f7c