mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
Mind possibly too long abbreviation
This commit is contained in:
parent
0afe7c2231
commit
fea02031c1
@ -154,16 +154,20 @@ const hashFromPopupData = function(reset) {
|
|||||||
const formatNumber = function(count) {
|
const formatNumber = function(count) {
|
||||||
if ( typeof count !== 'number' ) { return ''; }
|
if ( typeof count !== 'number' ) { return ''; }
|
||||||
if ( count < 1e6 ) { return count.toLocaleString(); }
|
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;
|
let unit;
|
||||||
if ( count < 1e9 ) {
|
if ( count < 1e9 ) {
|
||||||
count /= 1e6;
|
count /= 1e6;
|
||||||
unit = 'M';
|
unit = mln;
|
||||||
} else {
|
} else {
|
||||||
count /= 1e9;
|
count /= 1e9;
|
||||||
unit = 'G';
|
unit = vAPI.i18n('G');
|
||||||
}
|
}
|
||||||
return count.toLocaleString(undefined, { maximumSignificantDigits: 4 }) +
|
return count.toLocaleString(undefined, { maximumSignificantDigits: 4 }) +
|
||||||
`\u2009${vAPI.i18n(unit)}`;
|
`\u2009${unit}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user