diff --git a/gulp/res/js/threadstat.js b/gulp/res/js/threadstat.js index 3d5145cf..a70d9333 100644 --- a/gulp/res/js/threadstat.js +++ b/gulp/res/js/threadstat.js @@ -1,4 +1,4 @@ -/* globals isThread */ +/* globals __n isThread */ window.addEventListener('DOMContentLoaded', () => { const statsElem = document.getElementById('threadstats'); @@ -49,8 +49,8 @@ window.addEventListener('DOMContentLoaded', () => { const numFiles = +statsElem.children[1].innerText.match(/^(\d+)/g); const filesTotal = numFiles + newFiles; const postTotal = numPosts + 1; - statsElem.children[0].innerText = `${postTotal} repl${postTotal === 1 ? 'y' : 'ies'}`; - statsElem.children[1].innerText = `${filesTotal} file${filesTotal === 1 ? '' : 's'}`; + statsElem.children[0].innerText = __n('%s replies', postTotal); + statsElem.children[1].innerText = __n('%s files', filesTotal); if (e.detail.json.userId) { const userId = e.detail.post.querySelector('.user-id'); idElems.push(userId); @@ -67,7 +67,7 @@ window.addEventListener('DOMContentLoaded', () => { statsElem.appendChild(spacer); statsElem.appendChild(uidSpan); } - statsElem.children[2].innerText = `${idMap.size} UID${idMap.size === 1 ? '' : 's'}`; + statsElem.children[2].innerText = __n('%s UIDs', idMap.size); } }); } diff --git a/locales/en.json b/locales/en.json index 5ae70f68..0c443e0f 100644 --- a/locales/en.json +++ b/locales/en.json @@ -29,6 +29,18 @@ "one": "Reply", "other": "Replies" }, + "%s replies": { + "one": "%s reply", + "other": "%s replies" + }, + "%s files": { + "one": "%s file", + "other": "%s files" + }, + "%s UIDs": { + "one": "%s UID", + "other": "%s UIDs" + }, "Captcha text": "Captcha text", "Please enable JavaScript to solve the captcha.": "Please enable JavaScript to solve the captcha.", "%s characters": { diff --git a/locales/pt.json b/locales/pt.json index 521aacc1..36e009b7 100644 --- a/locales/pt.json +++ b/locales/pt.json @@ -29,6 +29,18 @@ "one": "Reposta", "other": "Repostas" }, + "%s replies": { + "one": "%s reposta", + "other": "%s respostas" + }, + "%s files": { + "one": "%s ficheiro", + "other": "%s ficheiros" + }, + "%s UIDs": { + "one": "%s UID", + "other": "%s UIDs" + }, "Captcha text": "Código captcha", "Please enable JavaScript to solve the captcha.": "Necessita JavaScript.", "%s characters": { diff --git a/views/pages/thread.pug b/views/pages/thread.pug index b14d9bd0..8214ad3c 100644 --- a/views/pages/thread.pug +++ b/views/pages/thread.pug @@ -65,12 +65,12 @@ block content .pages +boardnav(null, true, true) #threadstats - span #{thread.replyposts} repl#{thread.replyposts === 1 ? 'y' : 'ies'} + span #{__n('%s replies', thread.replyposts)} | | - span #{thread.replyfiles + thread.files.length} file#{thread.replyfiles + thread.files.length === 1 ? '' : 's'} + span #{__n('%s files', thread.replyfiles + thread.files.length)} if board.settings.ids | | - span #{uids.size} UID#{uids.size === 1 ? '' : 's'} + span #{__n('%s UIDs', uids.size)} .jsonly#livetext .dot#livecolor | Connecting...