mirror of
https://github.com/go-gitea/gitea
synced 2024-11-17 23:54: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;
|
||
|
}
|
||
|
}
|
||
|
}
|