diff --git a/daemon.py b/daemon.py index 537cc644..26854ce7 100644 --- a/daemon.py +++ b/daemon.py @@ -898,7 +898,7 @@ class PubServer(BaseHTTPRequestHandler): if self.path.startswith('/login') or self.path=='/': # request basic auth - msg=htmlLogin(self.server.baseDir).encode('utf-8') + msg=htmlLogin(self.server.translate,self.server.baseDir).encode('utf-8') self._login_headers('text/html',len(msg)) self.wfile.write(msg) self.server.GETbusy=False @@ -1601,7 +1601,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ maxPostsInFeed, 'inbox', \ True,self.server.ocapAlways) - msg=htmlInbox(pageNumber,maxPostsInFeed, \ + msg=htmlInbox(self.server.translate, \ + pageNumber,maxPostsInFeed, \ self.server.session, \ self.server.baseDir, \ self.server.cachedWebfingers, \ @@ -1666,7 +1667,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ maxPostsInFeed, 'dm', \ True,self.server.ocapAlways) - msg=htmlInboxDMs(pageNumber,maxPostsInFeed, \ + msg=htmlInboxDMs(self.server.translate, \ + pageNumber,maxPostsInFeed, \ self.server.session, \ self.server.baseDir, \ self.server.cachedWebfingers, \ @@ -1726,7 +1728,8 @@ class PubServer(BaseHTTPRequestHandler): maxPostsInFeed, 'outbox', \ authorized, \ self.server.ocapAlways) - msg=htmlOutbox(pageNumber,maxPostsInFeed, \ + msg=htmlOutbox(self.server.translate, \ + pageNumber,maxPostsInFeed, \ self.server.session, \ self.server.baseDir, \ self.server.cachedWebfingers, \ @@ -1780,7 +1783,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ maxPostsInFeed, 'moderation', \ True,self.server.ocapAlways) - msg=htmlModeration(pageNumber,maxPostsInFeed, \ + msg=htmlModeration(self.server.translate, \ + pageNumber,maxPostsInFeed, \ self.server.session, \ self.server.baseDir, \ self.server.cachedWebfingers, \ @@ -2656,7 +2660,8 @@ class PubServer(BaseHTTPRequestHandler): moderationText=moderationStr.split('=')[1].strip() moderationText=moderationText.replace('+',' ').replace('%40','@').replace('%3A',':').replace('%23','#').strip() elif moderationStr.startswith('submitInfo'): - msg=htmlModerationInfo(self.server.baseDir).encode('utf-8') + msg=htmlModerationInfo(self.server.translate, \ + self.server.baseDir).encode('utf-8') self._login_headers('text/html',len(msg)) self.wfile.write(msg) self.server.POSTbusy=False diff --git a/translations/en.json b/translations/en.json index c9e1a759..1a1671bb 100644 --- a/translations/en.json +++ b/translations/en.json @@ -90,5 +90,21 @@ "Stop blocking": "Stop blocking", "Enter an emoji name to search for": "Enter an emoji name to search for", "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Enter an address, shared item, #hashtag, *skill or :emoji: to search for", - "Go Back": "Go Back" + "Go Back": "Go Back", + "Moderation Information": "Moderation Information", + "Suspended accounts": "Suspended accounts", + "These are currently suspended": "These are currently suspended", + "Blocked accounts and hashtags": "Blocked accounts and hashtags", + "These are globally blocked for all accounts on this instance": "These are globally blocked for all accounts on this instance", + "Any blocks or suspensions made by moderators will be shown here.": "Any blocks or suspensions made by moderators will be shown here.", + "Welcome. Please enter your login details below.": "Welcome. Please enter your login details below.", + "Welcome. Please login or register a new account.": "Welcome. Please login or register a new account.", + "Please enter some credentials": "Please enter some credentials", + "You will become the admin of this site.": "You will become the admin of this site.", + "Terms of Service": "Terms of Service", + "About this Instance": "About this Instance", + "Nickname": "Nickname", + "Enter Nickname": "Enter Nickname", + "Password": "Password", + "Enter Password": "Enter Password" } diff --git a/translations/fr.json b/translations/fr.json index afc28d2b..5c80d8bb 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -90,5 +90,21 @@ "Stop blocking": "Arrêtez le blocage", "Enter an emoji name to search for": "Entrez un nom emoji à rechercher", "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Entrez une adresse, un objet partagé, #hashtag, * skill ou: emoji: à rechercher", - "Go Back": "Retourner" + "Go Back": "Retourner", + "Moderation Information": "Informations de modération", + "Suspended accounts": "Comptes suspendus", + "These are currently suspended": "Ceux-ci sont actuellement suspendus", + "Blocked accounts and hashtags": "Comptes bloqués et hashtags", + "These are globally blocked for all accounts on this instance": "Ceux-ci sont globalement bloqués pour tous les comptes sur cette instance.", + "Any blocks or suspensions made by moderators will be shown here.": "Tous les blocages ou suspensions réalisés par les modérateurs seront affichés ici.", + "Welcome. Please enter your login details below.": "Bienvenue. S'il vous plaît entrer vos informations de connexion ci-dessous.", + "Welcome. Please login or register a new account.": "Bienvenue. Veuillez vous connecter ou créer un nouveau compte.", + "Please enter some credentials": "S'il vous plaît entrer des informations d'identification", + "You will become the admin of this site.": "Vous allez devenir l'administrateur de ce site.", + "Terms of Service": "Conditions d'utilisation", + "About this Instance": "A propos de cette instance", + "Nickname": "Pseudo", + "Enter Nickname": "Entrez le pseudo", + "Password": "Mot de passe", + "Enter Password": "Entrer le mot de passe" } diff --git a/webinterface.py b/webinterface.py index 5d98174b..edb4e39c 100644 --- a/webinterface.py +++ b/webinterface.py @@ -184,13 +184,13 @@ def htmlSearchSharedItems(baseDir: str,searchStr: str, \ sharedItemsForm+=htmlFooter() return sharedItemsForm -def htmlModerationInfo(baseDir: str) -> str: +def htmlModerationInfo(translate: {},baseDir: str) -> str: infoForm='' with open(baseDir+'/epicyon-profile.css', 'r') as cssFile: infoCSS=cssFile.read() infoForm=htmlHeader(infoCSS) - infoForm+='

Moderation Information

' + infoForm+='

'+translate['Moderation Information']+'

' infoShown=False suspendedFilename=baseDir+'/accounts/suspended.txt' @@ -199,8 +199,8 @@ def htmlModerationInfo(baseDir: str) -> str: suspendedStr = f.read() infoForm+= \ '
' \ - '
Suspended accounts' \ - '
These are currently suspended' \ + '
'+translate['Suspended accounts']+'' \ + '
'+translate['These are currently suspended']+ \ ' ' \ '
' infoShown=True @@ -211,13 +211,13 @@ def htmlModerationInfo(baseDir: str) -> str: blockedStr = f.read() infoForm+= \ '
' \ - '
Blocked accounts and hashtags' \ - '
These are globally blocked for all accounts on this instance' \ + '
'+translate['Blocked accounts and hashtags']+'' \ + '
'+translate['These are globally blocked for all accounts on this instance']+ \ ' ' \ '
' infoShown=True if not infoShown: - infoForm+='

Any blocks or suspensions made by moderators will be shown here.

' + infoForm+='

'+translate['Any blocks or suspensions made by moderators will be shown here.']+'

' infoForm+=htmlFooter() return infoForm @@ -542,7 +542,7 @@ def htmlGetLoginCredentials(loginParams: str,lastLoginTime: int) -> (str,str,boo register=True return nickname,password,register -def htmlLogin(baseDir: str) -> str: +def htmlLogin(translate: {},baseDir: str) -> str: """Shows the login screen """ accounts=noOfAccounts(baseDir) @@ -554,9 +554,10 @@ def htmlLogin(baseDir: str) -> str: copyfile(baseDir+'/img/login-background.png',baseDir+'/accounts/login-background.png') if accounts>0: - loginText='

Welcome. Please enter your login details below.

' + loginText='

'+translate['Welcome. Please enter your login details below.']+'

' else: - loginText='

Please enter some credentials

You will become the admin of this site.

' + loginText='

'+translate['Please enter some credentials']+'

' + loginText+='

'+translate['You will become the admin of this site.']+'

' if os.path.isfile(baseDir+'/accounts/login.txt'): # custom login message with open(baseDir+'/accounts/login.txt', 'r') as file: @@ -570,15 +571,15 @@ def htmlLogin(baseDir: str) -> str: if getConfigParam(baseDir,'registration')=='open': if int(getConfigParam(baseDir,'registrationsRemaining'))>0: if accounts>0: - loginText='

Welcome. Please login or register a new account.

' + loginText='

'+translate['Welcome. Please login or register a new account.']+'

' registerButtonStr='' - TOSstr='

Terms of Service

' - TOSstr+='

About this Instance

' + TOSstr='

'+translate['Terms of Service']+'

' + TOSstr+='

'+translate['About this Instance']+'

' loginButtonStr='' if accounts>0: - loginButtonStr='' + loginButtonStr='' loginForm=htmlHeader(loginCSS) loginForm+= \ @@ -589,11 +590,11 @@ def htmlLogin(baseDir: str) -> str: ' ' \ '' \ '
' \ - ' ' \ - ' ' \ + ' ' \ + ' ' \ '' \ - ' ' \ - ' '+ \ + ' ' \ + ' '+ \ registerButtonStr+loginButtonStr+ \ '
' \ '' @@ -1895,7 +1896,7 @@ def htmlTimeline(translate: {},pageNumber: int, \ tlStr+=htmlFooter() return tlStr -def htmlInbox(pageNumber: int,itemsPerPage: int, \ +def htmlInbox(translate: {},pageNumber: int,itemsPerPage: int, \ session,baseDir: str,wfRequest: {},personCache: {}, \ nickname: str,domain: str,port: int,inboxJson: {}, \ allowDeletion: bool, \ @@ -1905,33 +1906,36 @@ def htmlInbox(pageNumber: int,itemsPerPage: int, \ manuallyApproveFollowers= \ followerApprovalActive(baseDir,nickname,domain) - return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \ + return htmlTimeline(translate,pageNumber, \ + itemsPerPage,session,baseDir,wfRequest,personCache, \ nickname,domain,port,inboxJson,'inbox',allowDeletion, \ httpPrefix,projectVersion,manuallyApproveFollowers) -def htmlInboxDMs(pageNumber: int,itemsPerPage: int, \ +def htmlInboxDMs(translate: {},pageNumber: int,itemsPerPage: int, \ session,baseDir: str,wfRequest: {},personCache: {}, \ nickname: str,domain: str,port: int,inboxJson: {}, \ allowDeletion: bool, \ httpPrefix: str,projectVersion: str) -> str: """Show the DM timeline as html """ - return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \ + return htmlTimeline(translate,pageNumber, \ + itemsPerPage,session,baseDir,wfRequest,personCache, \ nickname,domain,port,inboxJson,'dm',allowDeletion, \ httpPrefix,projectVersion,False) -def htmlModeration(pageNumber: int,itemsPerPage: int, \ +def htmlModeration(translate: {},pageNumber: int,itemsPerPage: int, \ session,baseDir: str,wfRequest: {},personCache: {}, \ nickname: str,domain: str,port: int,inboxJson: {}, \ allowDeletion: bool, \ httpPrefix: str,projectVersion: str) -> str: """Show the moderation feed as html """ - return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \ + return htmlTimeline(translate,pageNumber, \ + itemsPerPage,session,baseDir,wfRequest,personCache, \ nickname,domain,port,inboxJson,'moderation',allowDeletion, \ httpPrefix,projectVersion,True) -def htmlOutbox(pageNumber: int,itemsPerPage: int, \ +def htmlOutbox(translate: {},pageNumber: int,itemsPerPage: int, \ session,baseDir: str,wfRequest: {},personCache: {}, \ nickname: str,domain: str,port: int,outboxJson: {}, \ allowDeletion: bool, @@ -1940,7 +1944,8 @@ def htmlOutbox(pageNumber: int,itemsPerPage: int, \ """ manuallyApproveFollowers= \ followerApprovalActive(baseDir,nickname,domain) - return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \ + return htmlTimeline(translate,pageNumber, \ + itemsPerPage,session,baseDir,wfRequest,personCache, \ nickname,domain,port,outboxJson,'outbox',allowDeletion, \ httpPrefix,projectVersion,manuallyApproveFollowers)