hubiinetwork / hubii-core

The home of hubii core (aka Omphalos UI), the reference desktop app for nahmii
GNU General Public License v3.0
21 stars 4 forks source link

Number formatting improvements & intl #709

Closed liamaharon closed 5 years ago

liamaharon commented 5 years ago

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat We should be using Intl.NumberFormat when displaying balances to keep things clean. Users should be able to choose a formatting system in the settings, similar to how they currently do with languages. eg

var number = 123456.789;

// German uses comma as decimal separator and period for thousands
console.log(new Intl.NumberFormat('de-DE').format(number));
// → 123.456,789

// Arabic in most Arabic speaking countries uses real Arabic digits
console.log(new Intl.NumberFormat('ar-EG').format(number));
// → ١٢٣٤٥٦٫٧٨٩

// India uses thousands/lakh/crore separators
console.log(new Intl.NumberFormat('en-IN').format(number));
// → 1,23,456.789