Translations for website profile field

merge-requests/30/head
Bob Mottram 2021-08-12 21:56:00 +01:00
parent 39ab8ecd53
commit 5a68eece77
20 changed files with 51 additions and 29 deletions

View File

@ -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)

View File

@ -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

View File

@ -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": "موقع إلكتروني"
}

View File

@ -472,5 +472,6 @@
"City or location of the wanted item": "Ciutat o ubicació de larticle 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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "वेबसाइट"
}

View File

@ -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"
}

View File

@ -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サイト"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "Интернет сайт"
}

View File

@ -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"
}

View File

@ -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": "网站"
}

View File

@ -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)