1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

Mind possibly too long abbreviation

This commit is contained in:
Raymond Hill 2020-04-23 10:08:06 -04:00
parent 0afe7c2231
commit fea02031c1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -154,16 +154,20 @@ const hashFromPopupData = function(reset) {
const formatNumber = function(count) {
if ( typeof count !== 'number' ) { return ''; }
if ( count < 1e6 ) { return count.toLocaleString(); }
const mln = vAPI.i18n('M');
if ( count < 1e7 && mln.length > 2 ) { // Maybe not worth abbreviating
return count.toLocaleString();
}
let unit;
if ( count < 1e9 ) {
count /= 1e6;
unit = 'M';
unit = mln;
} else {
count /= 1e9;
unit = 'G';
unit = vAPI.i18n('G');
}
return count.toLocaleString(undefined, { maximumSignificantDigits: 4 }) +
`\u2009${vAPI.i18n(unit)}`;
`\u2009${unit}`;
};
/******************************************************************************/