diff --git a/library/components/legends/SemanticTreeLegend.vue b/library/components/legends/SemanticTreeLegend.vue index fc92ae815..947da7d30 100644 --- a/library/components/legends/SemanticTreeLegend.vue +++ b/library/components/legends/SemanticTreeLegend.vue @@ -642,12 +642,15 @@ function numLocale() { } // ★ COMPACT IN THE READER'S NOTATION. This was `toFixed(1) + 'M'` / `+ 'k'`: English abbreviations with // an English decimal point on every Population cell in every locale. Intl's compact notation writes each -// language's own form (ru "12,3 млн", de "12,3 Mio.", ar "12.3 مليون", zh "1234.6万") at the same -// precision as before: one decimal for millions, whole thousands. +// language's own form (ru "1,2 млн", de "1,2 Mio.", ar "1.2 مليون", zh "123.5万"). +// ⚠ SIZED TO THE COLUMN, which is fixed (--stl-num-w: 60px at 10.5px mono, 70px at 13px). The local forms are +// longer than "12.3M": with one decimal everywhere de reached "123,5 Mio." (10 chars) — past both widths on +// the region rows, whose sums run to hundreds of millions. So one decimal only below 10 million, where it +// carries real information; whole units above. Worst case measured over all 11 locales: 8 Latin chars. function fmtPop(n) { if (!n) return '—' if (n >= 1e3) { - return new Intl.NumberFormat(numLocale(), { notation: 'compact', maximumFractionDigits: n >= 1e6 ? 1 : 0 }).format(n) + return new Intl.NumberFormat(numLocale(), { notation: 'compact', maximumFractionDigits: n >= 1e6 && n < 1e7 ? 1 : 0 }).format(n) } return n.toLocaleString(numLocale()) }