# HG changeset patch # User Emmanuel Gil Peyrot # Date 1590317467 -7200 # Node ID 427807059ca8f35314fdbb365331cfc25e8a302e # Parent 010b905a74d4cf797f89ba05e33c3f6a54ee8132 Use `` in JS for templating, and add two forgotten strings. diff --git a/client.js b/client.js --- a/client.js +++ b/client.js @@ -98,7 +98,7 @@ document.addEventListener('DOMContentLoa { if (status == Strophe.Status.CONNECTING) { console.log('Strophe is connecting.'); - connect_button.value = 'Log out'; + connect_button.value = `{% trans 'Log out' %}`; connect_button.classList.add('disconnect'); jid_element.disabled = true; pass_element.disabled = true; @@ -122,7 +122,7 @@ document.addEventListener('DOMContentLoa { const new_node = document.createElementNS('http://www.w3.org/1999/xhtml', 'span'); const parent_node = connect.parentNode; - const text = document.createTextNode('{% trans 'Logged in as {} ' %}'.replace('{}', connection.authzid)); + const text = document.createTextNode(`{% trans 'Logged in as ${connection.authzid} ' %}`); new_node.appendChild(text); parent_node.insertBefore(new_node, connect); @@ -140,7 +140,7 @@ document.addEventListener('DOMContentLoa function onDisconnected() { - connect_button.value = 'Log in'; + connect_button.value = `{% trans 'Log in' %}`; connect_button.classList.remove('disconnect'); jid_element.hidden = false; jid_element.disabled = false; diff --git a/locale/django.pot b/locale/django.pot --- a/locale/django.pot +++ b/locale/django.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-05-24 11:25+0200\n" +"POT-Creation-Date: 2020-05-24 12:38+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,14 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -msgid "Logged in as {} " +msgid "Log out" +msgstr "" + +#, python-brace-format +msgid "Logged in as ${connection.authzid} " +msgstr "" + +msgid "Log in" msgstr "" msgid "Prosody IM account configuration" @@ -170,8 +177,10 @@ msgstr "" msgid "⚠️ Purge my entire message archive" msgstr "" -msgid "Do you really want to remove the node {}?" +#, python-brace-format +msgid "Do you really want to remove the node ${node}?" msgstr "" -msgid "Do you really want to remove {}?" +#, python-brace-format +msgid "Do you really want to remove ${jid}?" msgstr "" diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-05-24 11:25+0200\n" +"POT-Creation-Date: 2020-05-24 12:38+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,7 +18,14 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -msgid "Logged in as {} " +msgid "Log out" +msgstr "" + +#, python-brace-format +msgid "Logged in as ${connection.authzid} " +msgstr "" + +msgid "Log in" msgstr "" msgid "Prosody IM account configuration" @@ -171,8 +178,10 @@ msgstr "" msgid "⚠️ Purge my entire message archive" msgstr "" -msgid "Do you really want to remove the node {}?" +#, python-brace-format +msgid "Do you really want to remove the node ${node}?" msgstr "" -msgid "Do you really want to remove {}?" +#, python-brace-format +msgid "Do you really want to remove ${jid}?" msgstr "" diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-05-24 11:25+0200\n" +"POT-Creation-Date: 2020-05-24 12:38+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,7 +18,14 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -msgid "Logged in as {} " +msgid "Log out" +msgstr "" + +#, python-brace-format +msgid "Logged in as ${connection.authzid} " +msgstr "" + +msgid "Log in" msgstr "" msgid "Prosody IM account configuration" @@ -171,8 +178,10 @@ msgstr "" msgid "⚠️ Purge my entire message archive" msgstr "" -msgid "Do you really want to remove the node {}?" +#, python-brace-format +msgid "Do you really want to remove the node ${node}?" msgstr "" -msgid "Do you really want to remove {}?" +#, python-brace-format +msgid "Do you really want to remove ${jid}?" msgstr "" diff --git a/pep.js b/pep.js --- a/pep.js +++ b/pep.js @@ -65,7 +65,7 @@ function initPEP(connection) { button.classList.add('btn-danger'); button.textContent = '✕'; button.onclick = function (evt) { - const really = confirm('{% trans 'Do you really want to remove the node {}?' %}'.replace('{}', node)); + const really = confirm(`{% trans 'Do you really want to remove the node ${node}?' %}`); if (!really) return; const iq = $iq({type: 'set'}) diff --git a/roster.js b/roster.js --- a/roster.js +++ b/roster.js @@ -55,7 +55,7 @@ function initRoster(connection) { button.classList.add('btn-danger'); button.textContent = '✕'; button.onclick = function (evt) { - const really = confirm('{% trans 'Do you really want to remove {}?' %}'.replace('{}', jid)); + const really = confirm(`{% trans 'Do you really want to remove ${jid}?' %}`); if (!really) return; const iq = $iq({type: 'set'})