mirror of
https://github.com/go-gitea/gitea
synced 2024-11-14 06:04:25 +00: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;
|
||
|
}
|
||
|
}
|
||
|
}
|