diff --git a/daemon.py b/daemon.py index 4f247e267..74469d140 100644 --- a/daemon.py +++ b/daemon.py @@ -421,7 +421,8 @@ class PubServer(BaseHTTPRequestHandler): schedulePost, eventDate, eventTime, - location, False) + location, False, + self.server.systemLanguage) if messageJson: # name field contains the answer messageJson['object']['name'] = answer @@ -13085,7 +13086,8 @@ class PubServer(BaseHTTPRequestHandler): fields['replyTo'], fields['replyTo'], fields['subject'], fields['schedulePost'], fields['eventDate'], fields['eventTime'], - fields['location'], False) + fields['location'], False, + self.server.systemLanguage) if messageJson: if fields['schedulePost']: return 1 @@ -13157,7 +13159,8 @@ class PubServer(BaseHTTPRequestHandler): fields['schedulePost'], fields['eventDate'], fields['eventTime'], - fields['location']) + fields['location'], + self.server.systemLanguage) if messageJson: if fields['schedulePost']: return 1 @@ -13284,7 +13287,8 @@ class PubServer(BaseHTTPRequestHandler): fields['schedulePost'], fields['eventDate'], fields['eventTime'], - fields['location']) + fields['location'], + self.server.systemLanguage) if messageJson: if fields['schedulePost']: return 1 @@ -13325,7 +13329,8 @@ class PubServer(BaseHTTPRequestHandler): fields['schedulePost'], fields['eventDate'], fields['eventTime'], - fields['location']) + fields['location'], + self.server.systemLanguage) if messageJson: if fields['schedulePost']: return 1 @@ -13370,7 +13375,8 @@ class PubServer(BaseHTTPRequestHandler): True, fields['schedulePost'], fields['eventDate'], fields['eventTime'], - fields['location']) + fields['location'], + self.server.systemLanguage) if messageJson: if fields['schedulePost']: return 1 @@ -13417,7 +13423,8 @@ class PubServer(BaseHTTPRequestHandler): True, fields['schedulePost'], fields['eventDate'], fields['eventTime'], - fields['location']) + fields['location'], + self.server.systemLanguage) if messageJson: if fields['schedulePost']: return 1 @@ -13449,7 +13456,8 @@ class PubServer(BaseHTTPRequestHandler): filename, attachmentMediaType, fields['imageDescription'], city, - self.server.debug, fields['subject']) + self.server.debug, fields['subject'], + self.server.systemLanguage) if messageJson: if self._postToOutbox(messageJson, __version__, nickname): return 1 @@ -13472,6 +13480,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.baseDir, nickname, self.server.domain) + intDuration = int(fields['duration']) messageJson = \ createQuestionPost(self.server.baseDir, nickname, @@ -13485,7 +13494,8 @@ class PubServer(BaseHTTPRequestHandler): fields['imageDescription'], city, fields['subject'], - int(fields['duration'])) + intDuration, + self.server.systemLanguage) if messageJson: if self.server.debug: print('DEBUG: new Question') @@ -15013,7 +15023,8 @@ def runDaemon(userAgentsBlocked: [], httpd.allowLocalNetworkAccess, httpd.peertubeInstances, verifyAllSignatures, - httpd.themeName), daemon=True) + httpd.themeName, + httpd.systemLanguage), daemon=True) print('Creating scheduled post thread') httpd.thrPostSchedule = \ diff --git a/desktop_client.py b/desktop_client.py index 0e2b0bd85..44dd245c7 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -468,7 +468,8 @@ def _desktopReplyToPost(session, postId: str, commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - debug, postId, postId, subject) == 0: + systemLanguage, debug, postId, postId, + subject) == 0: sayStr = 'Reply sent' else: sayStr = 'Reply failed' @@ -529,7 +530,8 @@ def _desktopNewPost(session, commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - debug, None, None, subject) == 0: + systemLanguage, debug, None, None, + subject) == 0: sayStr = 'Post sent' else: sayStr = 'Post failed' @@ -1217,7 +1219,8 @@ def _desktopNewDMbase(session, toHandle: str, commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - debug, None, None, subject) == 0: + systemLanguage, debug, None, None, + subject) == 0: sayStr = 'Direct message sent' else: sayStr = 'Direct message failed' diff --git a/epicyon.py b/epicyon.py index 0fc7f86d6..cc21d48fd 100644 --- a/epicyon.py +++ b/epicyon.py @@ -892,6 +892,8 @@ if not args.language: languageCode = getConfigParam(baseDir, 'language') if languageCode: args.language = languageCode + else: + args.language = 'en' # maximum number of new registrations if not args.maxRegistrations: @@ -1124,7 +1126,8 @@ if args.message: args.commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - args.debug, replyTo, replyTo, subject) + args.language, args.debug, + replyTo, replyTo, subject) for i in range(10): # TODO detect send success/fail time.sleep(1) @@ -2245,6 +2248,7 @@ if args.unfilterStr: sys.exit() if args.testdata: + args.language = 'en' city = 'London, England' nickname = 'testuser567' password = 'boringpassword' @@ -2334,7 +2338,7 @@ if args.testdata: testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "Zoiks!!!", testFollowersOnly, @@ -2346,7 +2350,7 @@ if args.testdata: testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "Hey scoob we need like a hundred more #milkshakes", testFollowersOnly, @@ -2358,7 +2362,7 @@ if args.testdata: testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "Getting kinda spooky around here", testFollowersOnly, @@ -2370,7 +2374,7 @@ if args.testdata: 'someone', testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "And they would have gotten away with it too" + "if it wasn't for those pesky hackers", @@ -2383,7 +2387,7 @@ if args.testdata: testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "man these centralized sites are like the worst!", testFollowersOnly, @@ -2395,7 +2399,7 @@ if args.testdata: testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "another mystery solved #test", testFollowersOnly, @@ -2407,7 +2411,7 @@ if args.testdata: testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) createPublicPost(baseDir, nickname, domain, port, httpPrefix, "let's go bowling", testFollowersOnly, @@ -2419,7 +2423,7 @@ if args.testdata: testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, args.language) domainFull = domain + ':' + str(port) clearFollows(baseDir, nickname, domain) followPerson(baseDir, nickname, domain, 'maxboardroom', domainFull, diff --git a/followingCalendar.py b/followingCalendar.py index 9f038899e..e5453eb2b 100644 --- a/followingCalendar.py +++ b/followingCalendar.py @@ -13,6 +13,7 @@ import os def _dirAcct(baseDir: str, nickname: str, domain: str) -> str: return baseDir + '/accounts/' + nickname + '@' + domain + def _portDomainRemove(domain: str) -> str: """If the domain has a port appended then remove it eg. mydomain.com:80 becomes mydomain.com diff --git a/inbox.py b/inbox.py index 1a129dae3..62cd13a7f 100644 --- a/inbox.py +++ b/inbox.py @@ -2107,7 +2107,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str, sendThreads: [], postLog: [], cachedWebfingers: {}, personCache: {}, translate: {}, debug: bool, - lastBounceMessage: []) -> bool: + lastBounceMessage: [], systemLanguage: str) -> bool: """Sends a bounce message back to the sending handle if a DM has been rejected """ @@ -2159,7 +2159,8 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str, imageDescription, city, inReplyTo, inReplyToAtomUri, subject, debug, schedulePost, - eventDate, eventTime, location) + eventDate, eventTime, location, + systemLanguage) if not postJsonObject: print('WARN: unable to create bounce message to ' + sendingHandle) return False @@ -2183,7 +2184,7 @@ def _isValidDM(baseDir: str, nickname: str, domain: str, port: int, personCache: {}, translate: {}, debug: bool, lastBounceMessage: [], - handle: str) -> bool: + handle: str, systemLanguage: str) -> bool: """Is the given message a valid DM? """ if nickname == 'inbox': @@ -2258,7 +2259,8 @@ def _isValidDM(baseDir: str, nickname: str, domain: str, port: int, cachedWebfingers, personCache, translate, debug, - lastBounceMessage) + lastBounceMessage, + systemLanguage) return False # dm index will be updated @@ -2284,7 +2286,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int, allowLocalNetworkAccess: bool, peertubeInstances: [], lastBounceMessage: [], - themeName: str) -> bool: + themeName: str, systemLanguage: str) -> bool: """ Anything which needs to be done after initial checks have passed """ actor = keyId @@ -2488,7 +2490,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int, personCache, translate, debug, lastBounceMessage, - handle): + handle, systemLanguage): return False # get the actor being replied to @@ -2850,7 +2852,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int, maxFollowers: int, allowLocalNetworkAccess: bool, peertubeInstances: [], verifyAllSignatures: bool, - themeName: str) -> None: + themeName: str, systemLanguage: str) -> None: """Processes received items and moves them to the appropriate directories """ @@ -3255,7 +3257,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int, allowLocalNetworkAccess, peertubeInstances, lastBounceMessage, - themeName) + themeName, systemLanguage) if debug: pprint(queueJson['post']) print('Queue: Queue post accepted') diff --git a/newsdaemon.py b/newsdaemon.py index 21b01c67a..647eecd16 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -516,7 +516,8 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str, federationList: [], sendThreads: [], postLog: [], maxMirroredArticles: int, - allowLocalNetworkAccess: bool) -> None: + allowLocalNetworkAccess: bool, + systemLanguage: str) -> None: """Converts rss items in a newswire into posts """ if not newswire: @@ -596,7 +597,7 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str, followersOnly, saveToFile, attachImageFilename, mediaType, imageDescription, city, - rssTitle) + rssTitle, systemLanguage) if not blog: continue @@ -773,7 +774,8 @@ def runNewswireDaemon(baseDir: str, httpd, httpd.sendThreads, httpd.postLog, httpd.maxMirroredArticles, - httpd.allowLocalNetworkAccess) + httpd.allowLocalNetworkAccess, + httpd.systemLanguage) print('Newswire feed converted to ActivityPub') if httpd.maxNewsPosts > 0: diff --git a/posts.py b/posts.py index 757751e31..5d8b645fb 100644 --- a/posts.py +++ b/posts.py @@ -838,7 +838,7 @@ def _createPostS2S(baseDir: str, nickname: str, domain: str, port: int, tags: [], attachImageFilename: str, mediaType: str, imageDescription: str, city: str, postObjectType: str, summary: str, - inReplyToAtomUri: str) -> {}: + inReplyToAtomUri: str, systemLanguage: str) -> {}: """Creates a new server-to-server post """ actorUrl = httpPrefix + '://' + domain + '/users/' + nickname @@ -875,7 +875,7 @@ def _createPostS2S(baseDir: str, nickname: str, domain: str, port: int, 'mediaType': 'text/html', 'content': content, 'contentMap': { - 'en': content + systemLanguage: content }, 'attachment': [], 'tag': tags, @@ -906,7 +906,7 @@ def _createPostC2S(baseDir: str, nickname: str, domain: str, port: int, tags: [], attachImageFilename: str, mediaType: str, imageDescription: str, city: str, postObjectType: str, summary: str, - inReplyToAtomUri: str) -> {}: + inReplyToAtomUri: str, systemLanguage: str) -> {}: """Creates a new client-to-server post """ idStr = \ @@ -933,7 +933,7 @@ def _createPostC2S(baseDir: str, nickname: str, domain: str, port: int, 'mediaType': 'text/html', 'content': content, 'contentMap': { - 'en': content + systemLanguage: content }, 'attachment': [], 'tag': tags, @@ -1075,7 +1075,8 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int, maximumAttendeeCapacity: int, repliesModerationOption: str, anonymousParticipationEnabled: bool, - eventStatus: str, ticketUrl: str) -> {}: + eventStatus: str, ticketUrl: str, + systemLanguage: str) -> {}: """Creates a message """ content = removeInvalidChars(content) @@ -1206,7 +1207,7 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int, tags, attachImageFilename, mediaType, imageDescription, city, postObjectType, summary, - inReplyToAtomUri) + inReplyToAtomUri, systemLanguage) else: newPost = \ _createPostC2S(baseDir, nickname, domain, port, @@ -1217,7 +1218,7 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int, tags, attachImageFilename, mediaType, imageDescription, city, postObjectType, summary, - inReplyToAtomUri) + inReplyToAtomUri, systemLanguage) _createPostMentions(ccUrl, newPost, toRecipients, tags) @@ -1424,7 +1425,8 @@ def createPublicPost(baseDir: str, schedulePost: bool, eventDate: str, eventTime: str, location: str, - isArticle: bool) -> {}: + isArticle: bool, + systemLanguage: str) -> {}: """Public post """ domainFull = getFullDomain(domain, port) @@ -1454,7 +1456,7 @@ def createPublicPost(baseDir: str, maximumAttendeeCapacity, repliesModerationOption, anonymousParticipationEnabled, - eventStatus, ticketUrl) + eventStatus, ticketUrl, systemLanguage) def _appendCitationsToBlogPost(baseDir: str, @@ -1496,7 +1498,7 @@ def createBlogPost(baseDir: str, inReplyTo: str, inReplyToAtomUri: str, subject: str, schedulePost: bool, eventDate: str, eventTime: str, - location: str) -> {}: + location: str, systemLanguage: str) -> {}: blogJson = \ createPublicPost(baseDir, nickname, domain, port, httpPrefix, @@ -1506,7 +1508,8 @@ def createBlogPost(baseDir: str, imageDescription, city, inReplyTo, inReplyToAtomUri, subject, schedulePost, - eventDate, eventTime, location, True) + eventDate, eventTime, location, + True, systemLanguage) blogJson['object']['url'] = \ blogJson['object']['url'].replace('/@', '/users/') _appendCitationsToBlogPost(baseDir, nickname, domain, blogJson) @@ -1519,7 +1522,7 @@ def createNewsPost(baseDir: str, content: str, followersOnly: bool, saveToFile: bool, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, - subject: str) -> {}: + subject: str, systemLanguage: str) -> {}: clientToServer = False inReplyTo = None inReplyToAtomUri = None @@ -1536,7 +1539,8 @@ def createNewsPost(baseDir: str, imageDescription, city, inReplyTo, inReplyToAtomUri, subject, schedulePost, - eventDate, eventTime, location, True) + eventDate, eventTime, location, + True, systemLanguage) blog['object']['type'] = 'Article' return blog @@ -1548,7 +1552,8 @@ def createQuestionPost(baseDir: str, clientToServer: bool, commentsEnabled: bool, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, - subject: str, durationDays: int) -> {}: + subject: str, durationDays: int, + systemLanguage: str) -> {}: """Question post with multiple choice options """ domainFull = getFullDomain(domain, port) @@ -1564,7 +1569,7 @@ def createQuestionPost(baseDir: str, False, False, None, None, subject, False, None, None, None, None, None, None, None, None, - None, None, None, None, None) + None, None, None, None, None, systemLanguage) messageJson['object']['type'] = 'Question' messageJson['object']['oneOf'] = [] messageJson['object']['votersCount'] = 0 @@ -1595,7 +1600,7 @@ def createUnlistedPost(baseDir: str, inReplyTo: str, inReplyToAtomUri: str, subject: str, schedulePost: bool, eventDate: str, eventTime: str, - location: str) -> {}: + location: str, systemLanguage: str) -> {}: """Unlisted post. This has the #Public and followers links inverted. """ domainFull = getFullDomain(domain, port) @@ -1611,7 +1616,7 @@ def createUnlistedPost(baseDir: str, inReplyTo, inReplyToAtomUri, subject, schedulePost, eventDate, eventTime, location, None, None, None, None, None, - None, None, None, None, None) + None, None, None, None, None, systemLanguage) def createFollowersOnlyPost(baseDir: str, @@ -1626,7 +1631,7 @@ def createFollowersOnlyPost(baseDir: str, inReplyToAtomUri: str, subject: str, schedulePost: bool, eventDate: str, eventTime: str, - location: str) -> {}: + location: str, systemLanguage: str) -> {}: """Followers only post """ domainFull = getFullDomain(domain, port) @@ -1642,7 +1647,7 @@ def createFollowersOnlyPost(baseDir: str, inReplyTo, inReplyToAtomUri, subject, schedulePost, eventDate, eventTime, location, None, None, None, None, None, - None, None, None, None, None) + None, None, None, None, None, systemLanguage) def getMentionedPeople(baseDir: str, httpPrefix: str, @@ -1694,7 +1699,7 @@ def createDirectMessagePost(baseDir: str, subject: str, debug: bool, schedulePost: bool, eventDate: str, eventTime: str, - location: str) -> {}: + location: str, systemLanguage: str) -> {}: """Direct Message post """ content = resolvePetnames(baseDir, nickname, domain, content) @@ -1717,7 +1722,7 @@ def createDirectMessagePost(baseDir: str, inReplyTo, inReplyToAtomUri, subject, schedulePost, eventDate, eventTime, location, None, None, None, None, None, - None, None, None, None, None) + None, None, None, None, None, systemLanguage) # mentioned recipients go into To rather than Cc messageJson['to'] = messageJson['object']['cc'] messageJson['object']['to'] = messageJson['to'] @@ -1735,7 +1740,7 @@ def createReportPost(baseDir: str, clientToServer: bool, commentsEnabled: bool, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, - debug: bool, subject: str = None) -> {}: + debug: bool, subject: str, systemLanguage: str) -> {}: """Send a report to moderators """ domainFull = getFullDomain(domain, port) @@ -1807,7 +1812,7 @@ def createReportPost(baseDir: str, True, False, None, None, subject, False, None, None, None, None, None, None, None, None, - None, None, None, None, None) + None, None, None, None, None, systemLanguage) if not postJsonObject: continue @@ -1891,7 +1896,7 @@ def sendPost(projectVersion: str, imageDescription: str, city: str, federationList: [], sendThreads: [], postLog: [], cachedWebfingers: {}, personCache: {}, - isArticle: bool, + isArticle: bool, systemLanguage: str, debug: bool = False, inReplyTo: str = None, inReplyToAtomUri: str = None, subject: str = None) -> int: """Post to another inbox @@ -1952,7 +1957,7 @@ def sendPost(projectVersion: str, inReplyToAtomUri, subject, False, None, None, None, None, None, None, None, None, - None, None, None, None, None) + None, None, None, None, None, systemLanguage) # get the senders private key privateKeyPem = _getPersonKey(nickname, domain, baseDir, 'private') @@ -2011,7 +2016,8 @@ def sendPostViaServer(projectVersion: str, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, cachedWebfingers: {}, personCache: {}, - isArticle: bool, debug: bool = False, + isArticle: bool, systemLanguage: str, + debug: bool = False, inReplyTo: str = None, inReplyToAtomUri: str = None, subject: str = None) -> int: @@ -2093,7 +2099,7 @@ def sendPostViaServer(projectVersion: str, inReplyToAtomUri, subject, False, None, None, None, None, None, None, None, None, - None, None, None, None, None) + None, None, None, None, None, systemLanguage) authHeader = createBasicAuthHeader(fromNickname, password) diff --git a/tests.py b/tests.py index 54f16e1e7..58bfa3d7b 100644 --- a/tests.py +++ b/tests.py @@ -452,6 +452,7 @@ def createServerAlice(path: str, domain: str, port: int, shutil.rmtree(path) os.mkdir(path) os.chdir(path) + systemLanguage = 'en' nickname = 'alice' httpPrefix = 'http' proxyType = None @@ -501,7 +502,7 @@ def createServerAlice(path: str, domain: str, port: int, testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) createPublicPost(path, nickname, domain, port, httpPrefix, "Curiouser and curiouser!", testFollowersOnly, @@ -514,7 +515,7 @@ def createServerAlice(path: str, domain: str, port: int, testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) createPublicPost(path, nickname, domain, port, httpPrefix, "In the gardens of memory, in the palace " + "of dreams, that is where you and I shall meet", @@ -528,7 +529,7 @@ def createServerAlice(path: str, domain: str, port: int, testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) global testServerAliceRunning testServerAliceRunning = True maxMentions = 10 @@ -579,6 +580,7 @@ def createServerBob(path: str, domain: str, port: int, shutil.rmtree(path) os.mkdir(path) os.chdir(path) + systemLanguage = 'en' nickname = 'bob' httpPrefix = 'http' proxyType = None @@ -626,7 +628,7 @@ def createServerBob(path: str, domain: str, port: int, testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) createPublicPost(path, nickname, domain, port, httpPrefix, "One of the things I've realised is that " + "I am very simple", @@ -640,7 +642,7 @@ def createServerBob(path: str, domain: str, port: int, testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) createPublicPost(path, nickname, domain, port, httpPrefix, "Quantum physics is a bit of a passion of mine", testFollowersOnly, @@ -653,7 +655,7 @@ def createServerBob(path: str, domain: str, port: int, testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) global testServerBobRunning testServerBobRunning = True maxMentions = 10 @@ -761,6 +763,7 @@ def testPostMessageBetweenServers(): testServerAliceRunning = False testServerBobRunning = False + systemLanguage = 'en' httpPrefix = 'http' proxyType = None @@ -861,7 +864,7 @@ def testPostMessageBetweenServers(): attachedImageFilename, mediaType, attachedImageDescription, city, federationList, aliceSendThreads, alicePostLog, aliceCachedWebfingers, - alicePersonCache, isArticle, inReplyTo, + alicePersonCache, isArticle, systemLanguage, inReplyTo, inReplyToAtomUri, subject) print('sendResult: ' + str(sendResult)) @@ -1052,6 +1055,7 @@ def testFollowBetweenServers(): testServerAliceRunning = False testServerBobRunning = False + systemLanguage = 'en' httpPrefix = 'http' proxyType = None federationList = [] @@ -1185,7 +1189,7 @@ def testFollowBetweenServers(): clientToServer, True, None, None, None, city, federationList, aliceSendThreads, alicePostLog, aliceCachedWebfingers, - alicePersonCache, isArticle, inReplyTo, + alicePersonCache, isArticle, systemLanguage, inReplyTo, inReplyToAtomUri, subject) print('sendResult: ' + str(sendResult)) @@ -1456,6 +1460,7 @@ def _testFollows(): def _testCreatePerson(): print('testCreatePerson') + systemLanguage = 'en' currDir = os.getcwd() nickname = 'test382' domain = 'badgerdomain.com' @@ -1500,7 +1505,7 @@ def _testCreatePerson(): testInReplyTo, testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) os.chdir(currDir) shutil.rmtree(baseDir) @@ -1554,6 +1559,7 @@ def testClientToServer(): testServerAliceRunning = False testServerBobRunning = False + systemLanguage = 'en' httpPrefix = 'http' proxyType = None federationList = [] @@ -1650,7 +1656,7 @@ def testClientToServer(): attachedImageFilename, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - True, None, None, None) + systemLanguage, True, None, None, None) print('sendResult: ' + str(sendResult)) for i in range(30): @@ -2869,6 +2875,7 @@ def _testGetMentionedPeople() -> None: def _testReplyToPublicPost() -> None: baseDir = os.getcwd() + systemLanguage = 'en' nickname = 'test7492362' domain = 'other.site' port = 443 @@ -2899,7 +2906,7 @@ def _testReplyToPublicPost() -> None: testInReplyToAtomUri, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, - testIsArticle) + testIsArticle, systemLanguage) # print(str(reply)) assert reply['object']['content'] == \ '
' + \
@@ -3391,6 +3398,7 @@ def _testFunctions():
def _testLinksWithinPost() -> None:
baseDir = os.getcwd()
+ systemLanguage = 'en'
nickname = 'test27636'
domain = 'rando.site'
port = 443
@@ -3423,7 +3431,7 @@ def _testLinksWithinPost() -> None:
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
- testIsArticle)
+ testIsArticle, systemLanguage)
assert postJsonObject['object']['content'] == \
' This is a test post with links.
' + \
@@ -3457,7 +3465,7 @@ def _testLinksWithinPost() -> None:
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
- testIsArticle)
+ testIsArticle, systemLanguage)
assert postJsonObject['object']['content'] == content