diff --git a/languages.py b/languages.py index a1c143f42..eab773b18 100644 --- a/languages.py +++ b/languages.py @@ -47,15 +47,21 @@ def setActorLanguages(baseDir: str, actorJson: {}, languagesStr: str) -> None: elif ' ' in languagesStr: separator = ' ' langList = languagesStr.lower().split(separator) - langList2 = [] + langList2 = '' for lang in langList: lang = lang.strip() if baseDir: languageFilename = baseDir + '/translations/' + lang + '.json' if os.path.isfile(languageFilename): - langList2.append(lang) + if langList2: + langList2 += ', ' + lang.strip() + else: + langList2 += lang.strip() else: - langList2.append(lang) + if langList2: + langList2 += ', ' + lang.strip() + else: + langList2 += lang.strip() # remove any existing value propertyFound = None diff --git a/tests.py b/tests.py index 54c253220..bfffb0aba 100644 --- a/tests.py +++ b/tests.py @@ -42,6 +42,7 @@ from follow import clearFollowers from follow import sendFollowRequestViaServer from follow import sendUnfollowRequestViaServer from siteactive import siteIsActive +from utils import getActorLanguagesList from utils import getCategoryTypes from utils import getSupportedLanguages from utils import setConfigParam @@ -5084,10 +5085,12 @@ def _testSetActorLanguages(): assert len(actorJson['attachment']) == 1 assert actorJson['attachment'][0]['name'] == 'Languages' assert actorJson['attachment'][0]['type'] == 'PropertyValue' - assert len(actorJson['attachment'][0]['value']) == 3 - assert 'en' in actorJson['attachment'][0]['value'] - assert 'fr' in actorJson['attachment'][0]['value'] - assert 'es' in actorJson['attachment'][0]['value'] + assert isinstance(actorJson['attachment'][0]['value'], str) + assert ',' in actorJson['attachment'][0]['value'] + langList = getActorLanguagesList(actorJson) + assert 'en' in langList + assert 'fr' in langList + assert 'es' in langList languagesStr = getActorLanguages(actorJson) assert languagesStr == 'en / es / fr'