You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
478 B
15 lines
478 B
2 years ago
|
import {prettyNumber} from '../utils.js';
|
||
|
|
||
|
const {lang} = document.documentElement;
|
||
|
|
||
|
export function initFormattingReplacements() {
|
||
|
// replace english formatted numbers with locale-specific separators
|
||
|
for (const el of document.getElementsByClassName('js-pretty-number')) {
|
||
|
const num = Number(el.getAttribute('data-value'));
|
||
|
const formatted = prettyNumber(num, lang);
|
||
|
if (formatted && formatted !== el.textContent) {
|
||
|
el.textContent = formatted;
|
||
|
}
|
||
|
}
|
||
|
}
|