mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-01 23:29:12 +01:00
15 lines
478 B
JavaScript
15 lines
478 B
JavaScript
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|