Translate profile edit screen

master
Bob Mottram 2019-09-07 10:56:14 +01:00
parent 78bacbea96
commit 1539395ae4
4 changed files with 64 additions and 25 deletions

View File

@ -1271,7 +1271,10 @@ class PubServer(BaseHTTPRequestHandler):
# edit profile in web interface # edit profile in web interface
if '/users/' in self.path and self.path.endswith('/editprofile'): 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._set_headers('text/html',len(msg),cookie)
self.wfile.write(msg) self.wfile.write(msg)
self.server.GETbusy=False self.server.GETbusy=False

View File

@ -106,5 +106,23 @@
"Nickname": "Nickname", "Nickname": "Nickname",
"Enter Nickname": "Enter Nickname", "Enter Nickname": "Enter Nickname",
"Password": "Password", "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"
} }

View File

@ -106,5 +106,23 @@
"Nickname": "Pseudo", "Nickname": "Pseudo",
"Enter Nickname": "Entrez le pseudo", "Enter Nickname": "Entrez le pseudo",
"Password": "Mot de passe", "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"
} }

View File

@ -384,7 +384,7 @@ def htmlSkillsSearch(baseDir: str,skillsearch: str,instanceOnly: bool,postsPerPa
skillSearchForm+=htmlFooter() skillSearchForm+=htmlFooter()
return skillSearchForm 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 """Shows the edit profile screen
""" """
pathOriginal=path pathOriginal=path
@ -464,52 +464,52 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
moderators = f.read() moderators = f.read()
moderatorsStr= \ moderatorsStr= \
'<div class="container">' \ '<div class="container">' \
' <b>Moderators</b><br>' \ ' <b>'+translate['Moderators']+'</b><br>' \
' A list of moderator nicknames. One per line.' \ ' '+translate['A list of moderator nicknames. One per line.']+ \
' <textarea id="message" name="moderators" placeholder="List of moderator nicknames..." style="height:200px">'+moderators+'</textarea>' \ ' <textarea id="message" name="moderators" placeholder="'+translate['List of moderator nicknames']+'..." style="height:200px">'+moderators+'</textarea>' \
'</div>' '</div>'
editProfileForm=htmlHeader(editProfileCSS) editProfileForm=htmlHeader(editProfileCSS)
editProfileForm+= \ editProfileForm+= \
'<form enctype="multipart/form-data" method="POST" action="'+path+'/profiledata">' \ '<form enctype="multipart/form-data" method="POST" action="'+path+'/profiledata">' \
' <div class="vertical-center">' \ ' <div class="vertical-center">' \
' <p class="new-post-text">Profile for '+nickname+'@'+domainFull+'</p>' \ ' <p class="new-post-text">'+translate['Profile for']+' '+nickname+'@'+domainFull+'</p>' \
' <div class="container">' \ ' <div class="container">' \
' <input type="submit" name="submitProfile" value="Submit">' \ ' <input type="submit" name="submitProfile" value="'+translate['Submit']+'">' \
' <a href="'+pathOriginal+'"><button class="cancelbtn">Cancel</button></a>' \ ' <a href="'+pathOriginal+'"><button class="cancelbtn">'+translate['Cancel']+'</button></a>' \
' </div>'+ \ ' </div>'+ \
' <div class="container">' \ ' <div class="container">' \
' <input type="text" placeholder="name" name="displayNickname" value="'+displayNickname+'">' \ ' <input type="text" placeholder="name" name="displayNickname" value="'+displayNickname+'">' \
' <textarea id="message" name="bio" placeholder="Your bio..." style="height:200px">'+bioStr+'</textarea>' \ ' <textarea id="message" name="bio" placeholder="'+translate['Your bio']+'..." style="height:200px">'+bioStr+'</textarea>' \
' </div>' \ ' </div>' \
' <div class="container">' \ ' <div class="container">' \
' The files attached below should be no larger than 10MB in total uploaded at once.<br>' \ ' '+translate['The files attached below should be no larger than 10MB in total uploaded at once.']+'<br>' \
' Avatar image' \ ' '+translate['Avatar image']+ \
' <input type="file" id="avatar" name="avatar"' \ ' <input type="file" id="avatar" name="avatar"' \
' accept=".png">' \ ' accept=".png">' \
' <br>Background image' \ ' <br>'+translate['Background image']+ \
' <input type="file" id="image" name="image"' \ ' <input type="file" id="image" name="image"' \
' accept=".png">' \ ' accept=".png">' \
' <br>Timeline banner image' \ ' <br>'+translate['Timeline banner image']+ \
' <input type="file" id="banner" name="banner"' \ ' <input type="file" id="banner" name="banner"' \
' accept=".png">' \ ' accept=".png">' \
' </div>' \ ' </div>' \
' <div class="container">' \ ' <div class="container">' \
' <input type="checkbox" class=profilecheckbox" name="approveFollowers" '+manuallyApprovesFollowers+'>Approve follower requests<br>' \ ' <input type="checkbox" class=profilecheckbox" name="approveFollowers" '+manuallyApprovesFollowers+'>'+translate['Approve follower requests']+'<br>' \
' <input type="checkbox" class=profilecheckbox" name="isBot" '+isBot+'>This is a bot account<br>' \ ' <input type="checkbox" class=profilecheckbox" name="isBot" '+isBot+'>'+translate['This is a bot account']+'<br>' \
' <br><b>Filtered words</b>' \ ' <br><b>'+translate['Filtered words']+'</b>' \
' <br>One per line' \ ' <br>'+translate['One per line']+ \
' <textarea id="message" name="filteredWords" placeholder="" style="height:200px">'+filterStr+'</textarea>' \ ' <textarea id="message" name="filteredWords" placeholder="" style="height:200px">'+filterStr+'</textarea>' \
' <br><b>Blocked accounts</b>' \ ' <br><b>'+translate['Blocked accounts']+'</b>' \
' <br>Blocked accounts, one per line, in the form <i>nickname@domain</i> or <i>*@blockeddomain</i>' \ ' <br>'+translate['Blocked accounts, one per line, in the form nickname@domain or *@blockeddomain']+ \
' <textarea id="message" name="blocked" placeholder="" style="height:200px">'+blockedStr+'</textarea>' \ ' <textarea id="message" name="blocked" placeholder="" style="height:200px">'+blockedStr+'</textarea>' \
' <br><b>Federation list</b>' \ ' <br><b>'+translate['Federation list']+'</b>' \
' <br>Federate only with a defined set of instances. One domain name per line.' \ ' <br>'+translate['Federate only with a defined set of instances. One domain name per line.']+ \
' <textarea id="message" name="allowedInstances" placeholder="" style="height:200px">'+allowedInstancesStr+'</textarea>' \ ' <textarea id="message" name="allowedInstances" placeholder="" style="height:200px">'+allowedInstancesStr+'</textarea>' \
' </div>' \ ' </div>' \
' <div class="container">' \ ' <div class="container">' \
' <b>Skills</b><br>' \ ' <b>'+translate['Skills']+'</b><br>' \
' 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['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+ \ skillsStr+moderatorsStr+ \
' </div>' \ ' </div>' \
' </div>' \ ' </div>' \