diff client.js @ 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 6d861d881b96
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;