changeset 56:010b905a74d4

Update translation strings - prepend i18n loading for all "templates" - add some strings - commit the po files to the repo
author mathieui
date Sun, 24 May 2020 11:27:10 +0200
parents 6a7a99f5a0ca
children 427807059ca8
files build_website.py client.js index.xhtml locale/django.pot locale/en/LC_MESSAGES/django.po locale/fr/LC_MESSAGES/django.po pep.js roster.js
diffstat 8 files changed, 538 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/build_website.py
+++ b/build_website.py
@@ -72,7 +72,7 @@ def generate_pages(language):
     ]
     for file_to_localize in files:
         with open(file_to_localize) as template_file:
-            template = Template(template_file.read())
+            template = Template('{% load i18n %}' + template_file.read())
         rendered = template.render(Context({'AVAILABLE_LANGUAGES':
                                             AVAILABLE_LANGUAGES}))
         filename = path.join(target_dir, file_to_localize)
--- a/client.js
+++ b/client.js
@@ -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('Logged in as ' + connection.authzid + ' ');
+        const text = document.createTextNode('{% trans 'Logged in as {} ' %}'.replace('{}', connection.authzid));
         new_node.appendChild(text);
         parent_node.insertBefore(new_node, connect);
 
--- a/index.xhtml
+++ b/index.xhtml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{% load i18n %}en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
   <meta charset="utf-8"/>
   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"/>
new file mode 100644
--- /dev/null
+++ b/locale/django.pot
@@ -0,0 +1,177 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2020-05-24 11:25+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"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "Logged in as {} "
+msgstr ""
+
+msgid "Prosody IM account configuration"
+msgstr ""
+
+msgid "Enter your JID (or XMPP address), on the form “you@your-server.tld”"
+msgstr ""
+
+msgid "Enter the password used for this JID"
+msgstr ""
+
+msgid "Profile"
+msgstr ""
+
+msgid "Message Archiving"
+msgstr ""
+
+msgid "Account"
+msgstr ""
+
+msgid "PEP (advanced)"
+msgstr ""
+
+msgid "Nickname"
+msgstr ""
+
+msgid "Enter your nickname, so people you know can recognize you."
+msgstr ""
+
+msgid "Who can see your nickname?"
+msgstr ""
+
+msgid "Anyone"
+msgstr ""
+
+msgid "Only your contacts"
+msgstr ""
+
+msgid "This image allows your contacts to quickly identify you."
+msgstr ""
+
+msgid "Upload new avatar"
+msgstr ""
+
+msgid "Choose file…"
+msgstr ""
+
+msgid "Use as your avatar"
+msgstr ""
+
+msgid "Who can see your avatar?"
+msgstr ""
+
+msgid "Anyone (pick this if you use public channel)"
+msgstr ""
+
+msgid "Only your contacts (⚠️ your avatar won’t be usable in public channels)"
+msgstr ""
+
+msgid "Personal Information"
+msgstr ""
+
+msgid "Who are you?"
+msgstr ""
+
+msgid "Full name"
+msgstr ""
+
+msgid "Enter your name, so people you know can recognize you."
+msgstr ""
+
+msgid "Email"
+msgstr ""
+
+msgid "This can be used if you forget your password."
+msgstr ""
+
+msgid "Birthday"
+msgstr ""
+
+msgid "Who can see your personal information?"
+msgstr ""
+
+msgid "JID"
+msgstr ""
+
+msgid "Name"
+msgstr ""
+
+msgid "Subscription"
+msgstr ""
+
+msgid "Groups"
+msgstr ""
+
+msgid "⚠️ Delete"
+msgstr ""
+
+msgid "Change my password"
+msgstr ""
+
+msgid "⚠️ Delete my account"
+msgstr ""
+
+msgid "PEP"
+msgstr ""
+
+msgid "This section is for <b>advanced</b> users, use at your own risk!"
+msgstr ""
+
+msgid "PEP node"
+msgstr ""
+
+msgid "Title"
+msgstr ""
+
+msgid "Description"
+msgstr ""
+
+msgid "Type"
+msgstr ""
+
+msgid "Which messages to store in your archive?"
+msgstr ""
+
+msgid "All messages"
+msgstr ""
+
+msgid "No messages"
+msgstr ""
+
+msgid "Messages from your contacts only"
+msgstr ""
+
+msgid "Always:"
+msgstr ""
+
+msgid "Never:"
+msgstr ""
+
+msgid "Retrieve my message archive"
+msgstr ""
+
+msgid "View my message archive"
+msgstr ""
+
+msgid "Download my entire message archive"
+msgstr ""
+
+msgid "⚠️ Purge my entire message archive"
+msgstr ""
+
+msgid "Do you really want to remove the node {}?"
+msgstr ""
+
+msgid "Do you really want to remove {}?"
+msgstr ""
new file mode 100644
--- /dev/null
+++ b/locale/en/LC_MESSAGES/django.po
@@ -0,0 +1,178 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2020-05-24 11:25+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"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgid "Logged in as {} "
+msgstr ""
+
+msgid "Prosody IM account configuration"
+msgstr ""
+
+msgid "Enter your JID (or XMPP address), on the form “you@your-server.tld”"
+msgstr ""
+
+msgid "Enter the password used for this JID"
+msgstr ""
+
+msgid "Profile"
+msgstr ""
+
+msgid "Message Archiving"
+msgstr ""
+
+msgid "Account"
+msgstr ""
+
+msgid "PEP (advanced)"
+msgstr ""
+
+msgid "Nickname"
+msgstr ""
+
+msgid "Enter your nickname, so people you know can recognize you."
+msgstr ""
+
+msgid "Who can see your nickname?"
+msgstr ""
+
+msgid "Anyone"
+msgstr ""
+
+msgid "Only your contacts"
+msgstr ""
+
+msgid "This image allows your contacts to quickly identify you."
+msgstr ""
+
+msgid "Upload new avatar"
+msgstr ""
+
+msgid "Choose file…"
+msgstr ""
+
+msgid "Use as your avatar"
+msgstr ""
+
+msgid "Who can see your avatar?"
+msgstr ""
+
+msgid "Anyone (pick this if you use public channel)"
+msgstr ""
+
+msgid "Only your contacts (⚠️ your avatar won’t be usable in public channels)"
+msgstr ""
+
+msgid "Personal Information"
+msgstr ""
+
+msgid "Who are you?"
+msgstr ""
+
+msgid "Full name"
+msgstr ""
+
+msgid "Enter your name, so people you know can recognize you."
+msgstr ""
+
+msgid "Email"
+msgstr ""
+
+msgid "This can be used if you forget your password."
+msgstr ""
+
+msgid "Birthday"
+msgstr ""
+
+msgid "Who can see your personal information?"
+msgstr ""
+
+msgid "JID"
+msgstr ""
+
+msgid "Name"
+msgstr ""
+
+msgid "Subscription"
+msgstr ""
+
+msgid "Groups"
+msgstr ""
+
+msgid "⚠️ Delete"
+msgstr ""
+
+msgid "Change my password"
+msgstr ""
+
+msgid "⚠️ Delete my account"
+msgstr ""
+
+msgid "PEP"
+msgstr ""
+
+msgid "This section is for <b>advanced</b> users, use at your own risk!"
+msgstr ""
+
+msgid "PEP node"
+msgstr ""
+
+msgid "Title"
+msgstr ""
+
+msgid "Description"
+msgstr ""
+
+msgid "Type"
+msgstr ""
+
+msgid "Which messages to store in your archive?"
+msgstr ""
+
+msgid "All messages"
+msgstr ""
+
+msgid "No messages"
+msgstr ""
+
+msgid "Messages from your contacts only"
+msgstr ""
+
+msgid "Always:"
+msgstr ""
+
+msgid "Never:"
+msgstr ""
+
+msgid "Retrieve my message archive"
+msgstr ""
+
+msgid "View my message archive"
+msgstr ""
+
+msgid "Download my entire message archive"
+msgstr ""
+
+msgid "⚠️ Purge my entire message archive"
+msgstr ""
+
+msgid "Do you really want to remove the node {}?"
+msgstr ""
+
+msgid "Do you really want to remove {}?"
+msgstr ""
new file mode 100644
--- /dev/null
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -0,0 +1,178 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2020-05-24 11:25+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"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+msgid "Logged in as {} "
+msgstr ""
+
+msgid "Prosody IM account configuration"
+msgstr ""
+
+msgid "Enter your JID (or XMPP address), on the form “you@your-server.tld”"
+msgstr ""
+
+msgid "Enter the password used for this JID"
+msgstr ""
+
+msgid "Profile"
+msgstr ""
+
+msgid "Message Archiving"
+msgstr ""
+
+msgid "Account"
+msgstr ""
+
+msgid "PEP (advanced)"
+msgstr ""
+
+msgid "Nickname"
+msgstr ""
+
+msgid "Enter your nickname, so people you know can recognize you."
+msgstr ""
+
+msgid "Who can see your nickname?"
+msgstr ""
+
+msgid "Anyone"
+msgstr ""
+
+msgid "Only your contacts"
+msgstr ""
+
+msgid "This image allows your contacts to quickly identify you."
+msgstr ""
+
+msgid "Upload new avatar"
+msgstr ""
+
+msgid "Choose file…"
+msgstr ""
+
+msgid "Use as your avatar"
+msgstr ""
+
+msgid "Who can see your avatar?"
+msgstr ""
+
+msgid "Anyone (pick this if you use public channel)"
+msgstr ""
+
+msgid "Only your contacts (⚠️ your avatar won’t be usable in public channels)"
+msgstr ""
+
+msgid "Personal Information"
+msgstr ""
+
+msgid "Who are you?"
+msgstr ""
+
+msgid "Full name"
+msgstr ""
+
+msgid "Enter your name, so people you know can recognize you."
+msgstr ""
+
+msgid "Email"
+msgstr ""
+
+msgid "This can be used if you forget your password."
+msgstr ""
+
+msgid "Birthday"
+msgstr ""
+
+msgid "Who can see your personal information?"
+msgstr ""
+
+msgid "JID"
+msgstr ""
+
+msgid "Name"
+msgstr ""
+
+msgid "Subscription"
+msgstr ""
+
+msgid "Groups"
+msgstr ""
+
+msgid "⚠️ Delete"
+msgstr ""
+
+msgid "Change my password"
+msgstr ""
+
+msgid "⚠️ Delete my account"
+msgstr ""
+
+msgid "PEP"
+msgstr ""
+
+msgid "This section is for <b>advanced</b> users, use at your own risk!"
+msgstr ""
+
+msgid "PEP node"
+msgstr ""
+
+msgid "Title"
+msgstr ""
+
+msgid "Description"
+msgstr ""
+
+msgid "Type"
+msgstr ""
+
+msgid "Which messages to store in your archive?"
+msgstr ""
+
+msgid "All messages"
+msgstr ""
+
+msgid "No messages"
+msgstr ""
+
+msgid "Messages from your contacts only"
+msgstr ""
+
+msgid "Always:"
+msgstr ""
+
+msgid "Never:"
+msgstr ""
+
+msgid "Retrieve my message archive"
+msgstr ""
+
+msgid "View my message archive"
+msgstr ""
+
+msgid "Download my entire message archive"
+msgstr ""
+
+msgid "⚠️ Purge my entire message archive"
+msgstr ""
+
+msgid "Do you really want to remove the node {}?"
+msgstr ""
+
+msgid "Do you really want to remove {}?"
+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('Do you really want to remove the node ' + node + '?');
+            const really = confirm('{% trans 'Do you really want to remove the node {}?' %}'.replace('{}', 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('Do you really want to remove ' + jid + '?');
+                const really = confirm('{% trans 'Do you really want to remove {}?' %}'.replace('{}', jid));
                 if (!really)
                     return;
                 const iq = $iq({type: 'set'})