Number patterns - Nemo64/meteor-translator GitHub Wiki

Simply printing out numbers like 15 might seem sufficient at first, but there are problems. Printing the result of 1/3 will present your user 0.3333333333333333 which is not that pretty and can destroy a layout. Another problem comes with huge numbers. 12,562,167,432 is way easier to read then 12562167432. This package provides an easy way to print those numbers more nicely.

normal: "{var}" # 15 - 0.3333333333333333 - 12562167432

default: "{var, number}" # 15 - 0.33 - 12,562,167,432
custom: "{var, number, 000}" # 015 - 000 - 12562167432
custom2: "{var, number, 0,000}" # 0,015 - 0,000 - 12,562,167,432
custom3: "{var, number, #,#00}" # 15 - 00 - 12,562,167,432
plus_number: "{num, number, +#,##0.##}" # +15 - +0.33 - +12,562,167,432

exponential: "{num, number, scientific}" # 1E0 - 3E-1 - 1E10
exponential_custom: "{num, number, 0.##E0}" # 1.5E1 - 3.33E-1 - 1.26E10

significant_number1: "{num, number, @,@@#}" # 015 - 0.3333 - 12,560,000,000
significant_number2: "{num, number, #,@##}" # 15 - 0.333 - 12,500,000,000
significant_number3: "{num, number, @,@@@}" # 0015 - 0.3333 - 12,560,000,000

percent: "{num, number, percent}" # 1,500% - 33% - 1,256,216,743,200%
percent_custom: "{num, number, #,000%}" # 1,500% - 033% - 1,256,216,743,200%
permille: "{num, number, #,000‰}" # 15,000% - 333% - 12,562,167,432,000%

readable_number_short: "{num, number, decimal, short}" # 15 - 0.33 - 13B
readable_number_long: "{num, number, decimal, long}" # 15 - 0.33 - 13 billion

As usual, the patterns follow the Unicode standard. You can read here about the patterns. Also characters like the point or comma will automatically adjust to the current language, as well as the default pattern.

However the specs tell something about currencies. These are not supported as of now but im open to ideas how to implement them. ;)