From 5a68eece770095e109e3edcb859869e3c1ac5d7b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 12 Aug 2021 21:56:00 +0100 Subject: [PATCH] Translations for website profile field --- daemon.py | 10 ++++++---- donate.py | 12 +++++++----- translations/ar.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/ku.json | 3 ++- translations/oc.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/sw.json | 3 ++- translations/zh.json | 3 ++- webapp_profile.py | 7 ++++--- 20 files changed, 51 insertions(+), 29 deletions(-) diff --git a/daemon.py b/daemon.py index 12ca47545..618438a48 100644 --- a/daemon.py +++ b/daemon.py @@ -4837,15 +4837,17 @@ class PubServer(BaseHTTPRequestHandler): actorChanged = True # change website - currentWebsite = getWebsite(actorJson) + currentWebsite = getWebsite(actorJson, + self.server.translate) if fields.get('websiteUrl'): if fields['websiteUrl'] != currentWebsite: setWebsite(actorJson, - fields['websiteUrl']) + fields['websiteUrl'], + self.server.translate) actorChanged = True else: if currentWebsite: - setWebsite(actorJson, '') + setWebsite(actorJson, '', self.server.translate) actorChanged = True # account moved to new address @@ -6184,7 +6186,7 @@ class PubServer(BaseHTTPRequestHandler): movedTo = actorJson['movedTo'] lockedAccount = getLockedAccount(actorJson) donateUrl = getDonationUrl(actorJson) - websiteUrl = getWebsite(actorJson) + websiteUrl = getWebsite(actorJson, self.server.translate) xmppAddress = getXmppAddress(actorJson) matrixAddress = getMatrixAddress(actorJson) ssbAddress = getSSBAddress(actorJson) diff --git a/donate.py b/donate.py index 5d271be54..2df6e928f 100644 --- a/donate.py +++ b/donate.py @@ -8,14 +8,14 @@ __status__ = "Production" __module_group__ = "Profile Metadata" -def _getDonationTypes() -> str: +def _getDonationTypes() -> []: return ('patreon', 'paypal', 'gofundme', 'liberapay', 'kickstarter', 'indiegogo', 'crowdsupply', 'subscribestar') -def _getWebsiteStrings() -> str: - return ('www', 'website', 'web', 'homepage') +def _getWebsiteStrings() -> []: + return ['www', 'website', 'web', 'homepage'] def getDonationUrl(actorJson: {}) -> str: @@ -43,12 +43,13 @@ def getDonationUrl(actorJson: {}) -> str: return '' -def getWebsite(actorJson: {}) -> str: +def getWebsite(actorJson: {}, translate: {}) -> str: """Returns a web address link """ if not actorJson.get('attachment'): return '' matchStrings = _getWebsiteStrings() + matchStrings.append(translate['Website']) for propertyValue in actorJson['attachment']: if not propertyValue.get('name'): continue @@ -129,7 +130,7 @@ def setDonationUrl(actorJson: {}, donateUrl: str) -> None: actorJson['attachment'].append(newDonate) -def setWebsite(actorJson: {}, websiteUrl: str) -> None: +def setWebsite(actorJson: {}, websiteUrl: str, translate: {}) -> None: """Sets a web address """ notUrl = False @@ -146,6 +147,7 @@ def setWebsite(actorJson: {}, websiteUrl: str) -> None: actorJson['attachment'] = [] matchStrings = _getWebsiteStrings() + matchStrings.append(translate['Website']) # remove any existing value propertyFound = None diff --git a/translations/ar.json b/translations/ar.json index d6408ec30..f5c21b153 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "مدينة أو موقع العنصر المطلوب", "Maximum Price": "السعر الأقصى", "Create a new wanted item": "قم بإنشاء عنصر مطلوب جديد", - "Wanted Items Search": "البحث عن العناصر المطلوبة" + "Wanted Items Search": "البحث عن العناصر المطلوبة", + "Website": "موقع إلكتروني" } diff --git a/translations/ca.json b/translations/ca.json index 7d80a5e6c..3e149f82f 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Ciutat o ubicació de l’article desitjat", "Maximum Price": "Preu màxim", "Create a new wanted item": "Creeu un element desitjat", - "Wanted Items Search": "Cerca d'articles desitjats" + "Wanted Items Search": "Cerca d'articles desitjats", + "Website": "Lloc web" } diff --git a/translations/cy.json b/translations/cy.json index 4af3b83d6..6ce8726f7 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Dinas neu leoliad yr eitem sydd ei eisiau", "Maximum Price": "Uchafswm Pris", "Create a new wanted item": "Creu eitem newydd ei heisiau", - "Wanted Items Search": "Chwilio Eitemau Eisiau" + "Wanted Items Search": "Chwilio Eitemau Eisiau", + "Website": "Gwefan" } diff --git a/translations/de.json b/translations/de.json index d8d6e4566..99f18cae3 100644 --- a/translations/de.json +++ b/translations/de.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Stadt oder Ort des gesuchten Artikels", "Maximum Price": "Höchstpreis", "Create a new wanted item": "Erstelle einen neuen gesuchten Artikel", - "Wanted Items Search": "Gesuchte Artikel suchen" + "Wanted Items Search": "Gesuchte Artikel suchen", + "Website": "Webseite" } diff --git a/translations/en.json b/translations/en.json index bf13f5b0e..bec304dae 100644 --- a/translations/en.json +++ b/translations/en.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "City or location of the wanted item", "Maximum Price": "Maximum Price", "Create a new wanted item": "Create a new wanted item", - "Wanted Items Search": "Wanted Items Search" + "Wanted Items Search": "Wanted Items Search", + "Website": "Website" } diff --git a/translations/es.json b/translations/es.json index d8a8e0c5e..cbe428a40 100644 --- a/translations/es.json +++ b/translations/es.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Ciudad o ubicación del artículo buscado", "Maximum Price": "Precio Máximo", "Create a new wanted item": "Crea un nuevo artículo buscado", - "Wanted Items Search": "Búsqueda de artículos deseados" + "Wanted Items Search": "Búsqueda de artículos deseados", + "Website": "Sitio web" } diff --git a/translations/fr.json b/translations/fr.json index 1581789a7..6484fdec8 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Ville ou lieu de l'article recherché", "Maximum Price": "Prix maximum", "Create a new wanted item": "Créer un nouvel article recherché", - "Wanted Items Search": "Recherche d'objets recherchés" + "Wanted Items Search": "Recherche d'objets recherchés", + "Website": "Site Internet" } diff --git a/translations/ga.json b/translations/ga.json index 110bcd96e..e264cbbfd 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Cathair nó suíomh an earra a theastaigh", "Maximum Price": "Uasphraghas", "Create a new wanted item": "Cruthaigh mír nua a theastaigh", - "Wanted Items Search": "Cuardaigh Míreanna Teastaíonn" + "Wanted Items Search": "Cuardaigh Míreanna Teastaíonn", + "Website": "Suíomh gréasáin" } diff --git a/translations/hi.json b/translations/hi.json index 1a5102588..04928a602 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "वांछित वस्तु का शहर या स्थान", "Maximum Price": "अधिकतम मूल्य", "Create a new wanted item": "एक नई वांछित वस्तु बनाएँ", - "Wanted Items Search": "वांटेड आइटम सर्च" + "Wanted Items Search": "वांटेड आइटम सर्च", + "Website": "वेबसाइट" } diff --git a/translations/it.json b/translations/it.json index abbea8c1c..023a231ca 100644 --- a/translations/it.json +++ b/translations/it.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Città o posizione dell'articolo desiderato", "Maximum Price": "Prezzo massimo", "Create a new wanted item": "Crea un nuovo oggetto ricercato", - "Wanted Items Search": "Ricerca articoli ricercati" + "Wanted Items Search": "Ricerca articoli ricercati", + "Website": "Sito web" } diff --git a/translations/ja.json b/translations/ja.json index 74a30d6b5..f478adecb 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "欲しいアイテムの都市または場所", "Maximum Price": "最高価格", "Create a new wanted item": "新しい欲しいアイテムを作成する", - "Wanted Items Search": "欲しいアイテム検索" + "Wanted Items Search": "欲しいアイテム検索", + "Website": "Webサイト" } diff --git a/translations/ku.json b/translations/ku.json index acab522d4..9e6bff56d 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Bajar an cîhê tiştê xwestî", "Maximum Price": "Maximum Price", "Create a new wanted item": "Tiştek xwestî ya nû biafirînin", - "Wanted Items Search": "Wanted Items Search" + "Wanted Items Search": "Wanted Items Search", + "Website": "Malper" } diff --git a/translations/oc.json b/translations/oc.json index ce60304af..334d61406 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -468,5 +468,6 @@ "City or location of the wanted item": "City or location of the wanted item", "Maximum Price": "Maximum Price", "Create a new wanted item": "Create a new wanted item", - "Wanted Items Search": "Wanted Items Search" + "Wanted Items Search": "Wanted Items Search", + "Website": "Website" } diff --git a/translations/pt.json b/translations/pt.json index ee84b4cfc..af9c7b686 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Cidade ou localização do item desejado", "Maximum Price": "Preço Máximo", "Create a new wanted item": "Crie um novo item desejado", - "Wanted Items Search": "Pesquisa de Itens Desejados" + "Wanted Items Search": "Pesquisa de Itens Desejados", + "Website": "Local na rede Internet" } diff --git a/translations/ru.json b/translations/ru.json index 8384dedab..eeb3a6517 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Город или местонахождение разыскиваемого предмета", "Maximum Price": "Максимальная цена", "Create a new wanted item": "Создать новый требуемый предмет", - "Wanted Items Search": "Поиск требуемых предметов" + "Wanted Items Search": "Поиск требуемых предметов", + "Website": "Интернет сайт" } diff --git a/translations/sw.json b/translations/sw.json index 49a84fc7a..c526a8d11 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "Jiji au eneo la kitu kinachotafutwa", "Maximum Price": "Bei ya juu", "Create a new wanted item": "Unda kipengee kipya kinachotafutwa", - "Wanted Items Search": "Utafutaji wa Vitu vinavyotafutwa" + "Wanted Items Search": "Utafutaji wa Vitu vinavyotafutwa", + "Website": "Tovuti" } diff --git a/translations/zh.json b/translations/zh.json index dfb16a878..0be996667 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -472,5 +472,6 @@ "City or location of the wanted item": "通缉物品的城市或位置", "Maximum Price": "最高价格", "Create a new wanted item": "创建一个新的通缉物品", - "Wanted Items Search": "通缉物品搜索" + "Wanted Items Search": "通缉物品搜索", + "Website": "网站" } diff --git a/webapp_profile.py b/webapp_profile.py index 32e76bf5e..3980fc4ea 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -548,7 +548,7 @@ def htmlProfile(rssIconAtTop: bool, donateSection = '' donateUrl = getDonationUrl(profileJson) - websiteUrl = getWebsite(profileJson) + websiteUrl = getWebsite(profileJson, translate) PGPpubKey = getPGPpubKey(profileJson) PGPfingerprint = getPGPfingerprint(profileJson) emailAddress = getEmailAddress(profileJson) @@ -1774,7 +1774,8 @@ def _htmlEditProfileMain(baseDir: str, displayNickname: str, bioStr: str, donateUrl, 'https://...') editProfileForm += \ - editTextField('Website', 'websiteUrl', websiteUrl, 'https://...') + editTextField(translate['Website'], 'websiteUrl', + websiteUrl, 'https://...') editProfileForm += \ editTextField('Blog', 'blogAddress', blogAddress, 'https://...') @@ -1863,7 +1864,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, if actorJson.get('movedTo'): movedTo = actorJson['movedTo'] donateUrl = getDonationUrl(actorJson) - websiteUrl = getWebsite(actorJson) + websiteUrl = getWebsite(actorJson, translate) xmppAddress = getXmppAddress(actorJson) matrixAddress = getMatrixAddress(actorJson) ssbAddress = getSSBAddress(actorJson)