From 1539395ae4f2a3b9a4e4c16c55ea4c4fc095b5d6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 7 Sep 2019 10:56:14 +0100 Subject: [PATCH] Translate profile edit screen --- daemon.py | 5 ++++- translations/en.json | 20 +++++++++++++++++++- translations/fr.json | 20 +++++++++++++++++++- webinterface.py | 44 ++++++++++++++++++++++---------------------- 4 files changed, 64 insertions(+), 25 deletions(-) diff --git a/daemon.py b/daemon.py index 26854ce7a..c6b1e5608 100644 --- a/daemon.py +++ b/daemon.py @@ -1271,7 +1271,10 @@ class PubServer(BaseHTTPRequestHandler): # edit profile in web interface if '/users/' in self.path and self.path.endswith('/editprofile'): - msg=htmlEditProfile(self.server.baseDir,self.path,self.server.domain,self.server.port).encode() + msg=htmlEditProfile(self.server.translate, \ + self.server.baseDir, \ + self.path,self.server.domain, \ + self.server.port).encode() self._set_headers('text/html',len(msg),cookie) self.wfile.write(msg) self.server.GETbusy=False diff --git a/translations/en.json b/translations/en.json index 1a1671bba..49cc6513d 100644 --- a/translations/en.json +++ b/translations/en.json @@ -106,5 +106,23 @@ "Nickname": "Nickname", "Enter Nickname": "Enter Nickname", "Password": "Password", - "Enter Password": "Enter Password" + "Enter Password": "Enter Password", + "Profile for": "Profile for", + "The files attached below should be no larger than 10MB in total uploaded at once.": "The files attached below should be no larger than 10MB in total uploaded at once.", + "Avatar image": "Avatar image", + "Background image": "Background image", + "Timeline banner image": "Timeline banner image", + "Approve follower requests": "Approve follower requests", + "This is a bot account": "This is a bot account", + "Filtered words": "Filtered words", + "One per line": "One per line", + "Blocked accounts": "Blocked accounts", + "Blocked accounts, one per line, in the form nickname@domain or *@blockeddomain": "Blocked accounts, one per line, in the form nickname@domain or *@blockeddomain", + "Federation list": "Federation list", + "Federate only with a defined set of instances. One domain name per line.": "Federate only with a defined set of instances. One domain name per line.", + "If you want to participate within organizations then you can indicate some skills that you have and approximate proficiency levels. This helps organizers to construct teams with an appropriate combination of skills.": "If you want to participate within organizations then you can indicate some skills that you have and approximate proficiency levels. This helps organizers to construct teams with an appropriate combination of skills.", + "A list of moderator nicknames. One per line.": "A list of moderator nicknames. One per line.", + "Moderators": "Moderators", + "List of moderator nicknames": "List of moderator nicknames", + "Your bio": "Your bio" } diff --git a/translations/fr.json b/translations/fr.json index 5c80d8bbe..77fde7807 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -106,5 +106,23 @@ "Nickname": "Pseudo", "Enter Nickname": "Entrez le pseudo", "Password": "Mot de passe", - "Enter Password": "Entrer le mot de passe" + "Enter Password": "Entrer le mot de passe", + "Profile for": "Profil pour", + "The files attached below should be no larger than 10MB in total uploaded at once.": "Les fichiers joints ci-dessous ne doivent pas dépasser 10 Mo au total, téléchargés en même temps.", + "Avatar image": "Image d'avatar", + "Background image": "Image de fond", + "Timeline banner image": "Image de la bannière de la timeline", + "Approve follower requests": "Approuver les demandes de suiveurs", + "This is a bot account": "Ceci est un compte bot", + "Filtered words": "Mots filtrés", + "One per line": "Un par ligne", + "Blocked accounts": "Comptes bloqués", + "Blocked accounts, one per line, in the form nickname@domain or *@blockeddomain": "Comptes bloqués, un par ligne, sous la forme pseudo @ domaine ou * @ domaine bloqué", + "Federation list": "Liste de la fédération", + "Federate only with a defined set of instances. One domain name per line.": "Fédérer uniquement avec un ensemble défini d'instances. Un nom de domaine par ligne.", + "If you want to participate within organizations then you can indicate some skills that you have and approximate proficiency levels. This helps organizers to construct teams with an appropriate combination of skills.": "Si vous souhaitez participer au sein d'organisations, vous pouvez indiquer certaines de vos compétences et vous rapprocher des niveaux de compétence. Cela aide les organisateurs à construire des équipes avec une combinaison appropriée de compétences.", + "A list of moderator nicknames. One per line.": "Une liste de surnoms de modérateurs. Un par ligne.", + "Moderators": "Les modérateurs", + "List of moderator nicknames": "Liste des pseudo du modérateur", + "Your bio": "Votre biographie" } diff --git a/webinterface.py b/webinterface.py index f9d9ec09c..cf373e4da 100644 --- a/webinterface.py +++ b/webinterface.py @@ -384,7 +384,7 @@ def htmlSkillsSearch(baseDir: str,skillsearch: str,instanceOnly: bool,postsPerPa skillSearchForm+=htmlFooter() return skillSearchForm -def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str: +def htmlEditProfile(translate: {},baseDir: str,path: str,domain: str,port: int) -> str: """Shows the edit profile screen """ pathOriginal=path @@ -464,52 +464,52 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str: moderators = f.read() moderatorsStr= \ '
' \ - ' Moderators
' \ - ' A list of moderator nicknames. One per line.' \ - ' ' \ + ' '+translate['Moderators']+'
' \ + ' '+translate['A list of moderator nicknames. One per line.']+ \ + ' ' \ '
' editProfileForm=htmlHeader(editProfileCSS) editProfileForm+= \ '
' \ '
' \ - '

Profile for '+nickname+'@'+domainFull+'

' \ + '

'+translate['Profile for']+' '+nickname+'@'+domainFull+'

' \ '
' \ - ' ' \ - ' ' \ + ' ' \ + ' ' \ '
'+ \ '
' \ ' ' \ - ' ' \ + ' ' \ '
' \ '
' \ - ' The files attached below should be no larger than 10MB in total uploaded at once.
' \ - ' Avatar image' \ + ' '+translate['The files attached below should be no larger than 10MB in total uploaded at once.']+'
' \ + ' '+translate['Avatar image']+ \ ' ' \ - '
Background image' \ + '
'+translate['Background image']+ \ ' ' \ - '
Timeline banner image' \ + '
'+translate['Timeline banner image']+ \ ' ' \ '
' \ '
' \ - ' Approve follower requests
' \ - ' This is a bot account
' \ - '
Filtered words' \ - '
One per line' \ + ' '+translate['Approve follower requests']+'
' \ + ' '+translate['This is a bot account']+'
' \ + '
'+translate['Filtered words']+'' \ + '
'+translate['One per line']+ \ ' ' \ - '
Blocked accounts' \ - '
Blocked accounts, one per line, in the form nickname@domain or *@blockeddomain' \ + '
'+translate['Blocked accounts']+'' \ + '
'+translate['Blocked accounts, one per line, in the form nickname@domain or *@blockeddomain']+ \ ' ' \ - '
Federation list' \ - '
Federate only with a defined set of instances. One domain name per line.' \ + '
'+translate['Federation list']+'' \ + '
'+translate['Federate only with a defined set of instances. One domain name per line.']+ \ ' ' \ '
' \ '
' \ - ' Skills
' \ - ' If you want to participate within organizations then you can indicate some skills that you have and approximate proficiency levels. This helps organizers to construct teams with an appropriate combination of skills.'+ \ + ' '+translate['Skills']+'
' \ + ' '+translate['If you want to participate within organizations then you can indicate some skills that you have and approximate proficiency levels. This helps organizers to construct teams with an appropriate combination of skills.']+ \ skillsStr+moderatorsStr+ \ '
' \ '
' \