syeopite / lens

A multiformat internationalization (i18n) shard for Crystal.
MIT License
16 stars 1 forks source link

Finish implementation of CLDR number formatting #3

Open syeopite opened 3 years ago

syeopite commented 3 years ago

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.

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

syeopite commented 3 years ago

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

syeopite commented 3 years ago

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