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.
14 lines
478 B
14 lines
478 B
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;
|
|
}
|
|
}
|
|
}
|
|
|