fix(web): cleaner German fan-count format (559.542 instead of "559,5 Tsd.")
fmtCount now shows the full grouped number below a million (toLocaleString de-DE) and only
compacts millions ("1,2 Mio."). The old "Tsd." form read awkwardly on the artist hero. SW ns-v53.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
065d2f7319
commit
c92ac3d719
2 files changed
+5
-6
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
const CACHE = 'ns-v52';
|
||||
const CACHE = 'ns-v53';
|
||||
const PRECACHE = ['/', 'index.html', 'manifest.json', 'icon.svg'];
|
||||
const SKIP_PATHS = ['/rest/stream', '/rest/download', '/config.js'];
|
||||
// Auth token params stripped from cache keys so artwork survives across sessions/token refreshes.
|
||||
|
||||
+4
-5
@@ -45,13 +45,12 @@ export function formatDur(s) {
|
||||
return `${m}:${sec.toString().padStart(2,'0')}`;
|
||||
}
|
||||
|
||||
// Compact count for fan numbers etc.: 559534 → "559,5 Tsd.", 1200000 → "1,2 Mio."
|
||||
// Fan/count formatting in German: full grouped number up to a million (559534 → "559.542"),
|
||||
// then compact millions (1200000 → "1,2 Mio.").
|
||||
export function fmtCount(n) {
|
||||
if (n == null || isNaN(n)) return '';
|
||||
const de = x => x.toFixed(1).replace(/\.0$/, '').replace('.', ',');
|
||||
if (n >= 1e6) return de(n / 1e6) + ' Mio.';
|
||||
if (n >= 1e3) return de(n / 1e3) + ' Tsd.';
|
||||
return String(n);
|
||||
if (n >= 1e6) return (n / 1e6).toFixed(1).replace(/\.0$/, '').replace('.', ',') + ' Mio.';
|
||||
return Math.round(n).toLocaleString('de-DE');
|
||||
}
|
||||
|
||||
export function toast(msg) {
|
||||
|
||||
Reference in new issue
Block a user