changeset 57:427807059ca8

Use `` in JS for templating, and add two forgotten strings.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 24 May 2020 12:51:07 +0200
parents 010b905a74d4
children 524a2538394e
files client.js locale/django.pot locale/en/LC_MESSAGES/django.po locale/fr/LC_MESSAGES/django.po pep.js roster.js
diffstat 6 files changed, 44 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
--- 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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
--- 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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
--- 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'})
--- 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'})