Sort languages list

main
Bob Mottram 2021-07-18 19:57:08 +01:00
parent 0690c6d844
commit 1c75c14a6a
2 changed files with 12 additions and 6 deletions

View File

@ -2579,7 +2579,7 @@ def getActorLanguagesList(actorJson: {}) -> []:
if not isinstance(propertyValue['value'], list):
continue
if propertyValue['type'] != 'PropertyValue':
continue
continue
return propertyValue['value']
return []

View File

@ -1779,7 +1779,7 @@ def _htmlEditProfileOptions(manuallyApprovesFollowers: str,
def _getSupportedLanguages(baseDir: str) -> str:
"""Returns a list of supported languages
"""
languagesStr = ''
langList = []
for subdir, dirs, files in os.walk(baseDir + '/translations'):
for f in files:
if not f.endswith('.json'):
@ -1787,11 +1787,17 @@ def _getSupportedLanguages(baseDir: str) -> str:
langStr = f.split('.')[0]
if len(langStr) != 2:
continue
if languagesStr:
languagesStr += ' / ' + langStr
else:
languagesStr = langStr
langList.append(langStr)
break
if not langList:
return ''
langList.sort()
languagesStr = ''
for lang in langList:
if languagesStr:
languagesStr += ' / ' + lang
else:
languagesStr = lang
return languagesStr