localize other displayed numbers
This commit is contained in:
parent
a777a808ee
commit
cf36a33aea
@ -1,5 +1,6 @@
|
|||||||
const html = require('choo/html');
|
const html = require('choo/html');
|
||||||
const assets = require('../../common/assets');
|
const assets = require('../../common/assets');
|
||||||
|
const number = require('../utils').number;
|
||||||
|
|
||||||
function timeLeft(milliseconds, state) {
|
function timeLeft(milliseconds, state) {
|
||||||
const minutes = Math.floor(milliseconds / 1000 / 60);
|
const minutes = Math.floor(milliseconds / 1000 / 60);
|
||||||
@ -40,7 +41,9 @@ module.exports = function(file, state, emit) {
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="overflow-col">${remainingTime}</td>
|
<td class="overflow-col">${remainingTime}</td>
|
||||||
<td class="center-col">${totalDownloads} / ${downloadLimit}</td>
|
<td class="center-col">${number(totalDownloads)} / ${number(
|
||||||
|
downloadLimit
|
||||||
|
)}</td>
|
||||||
<td class="center-col">
|
<td class="center-col">
|
||||||
<img
|
<img
|
||||||
onclick=${showPopup}
|
onclick=${showPopup}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const html = require('choo/html');
|
const html = require('choo/html');
|
||||||
|
const number = require('../utils').number;
|
||||||
|
|
||||||
module.exports = function(selected, options, translate, changed) {
|
module.exports = function(selected, options, translate, changed) {
|
||||||
const id = `select-${Math.random()}`;
|
const id = `select-${Math.random()}`;
|
||||||
@ -47,7 +48,9 @@ module.exports = function(selected, options, translate, changed) {
|
|||||||
<ul id="${id}" class="selectOptions">
|
<ul id="${id}" class="selectOptions">
|
||||||
${options.map(
|
${options.map(
|
||||||
i =>
|
i =>
|
||||||
html`<li class="selectOption" onclick=${choose} data-value="${i}">${i}</li>`
|
html`<li class="selectOption" onclick=${choose} data-value="${i}">${number(
|
||||||
|
i
|
||||||
|
)}</li>`
|
||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -117,6 +117,14 @@ function percent(ratio) {
|
|||||||
return `${Math.floor(ratio * 100)}%`;
|
return `${Math.floor(ratio * 100)}%`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function number(n) {
|
||||||
|
if (LOCALIZE_NUMBERS) {
|
||||||
|
const locale = document.querySelector('html').lang;
|
||||||
|
return n.toLocaleString(locale);
|
||||||
|
}
|
||||||
|
return n.toString();
|
||||||
|
}
|
||||||
|
|
||||||
function allowedCopy() {
|
function allowedCopy() {
|
||||||
const support = !!document.queryCommandSupported;
|
const support = !!document.queryCommandSupported;
|
||||||
return support ? document.queryCommandSupported('copy') : false;
|
return support ? document.queryCommandSupported('copy') : false;
|
||||||
@ -171,6 +179,7 @@ module.exports = {
|
|||||||
allowedCopy,
|
allowedCopy,
|
||||||
bytes,
|
bytes,
|
||||||
percent,
|
percent,
|
||||||
|
number,
|
||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
arrayToB64,
|
arrayToB64,
|
||||||
b64ToArray,
|
b64ToArray,
|
||||||
|
Loading…
Reference in New Issue
Block a user