Fixed translation of discussions.py

This commit is contained in:
Frisk 2020-08-10 02:23:09 +02:00
parent ed131fb6da
commit b05608a024
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
2 changed files with 3 additions and 6 deletions

View file

@ -18,12 +18,12 @@ async def feeds_compact_formatter(post_type, post, message_target, wiki):
if post_type == "FORUM":
if not post["isReply"]:
thread_funnel = post.get("funnel")
msg_text = "[{author}](<{url}f/u/{creatorId}>) created [{title}](<{url}f/p/{threadId}>) in {forumName}"
msg_text = _("[{author}](<{url}f/u/{creatorId}>) created [{title}](<{url}f/p/{threadId}>) in {forumName}")
if thread_funnel == "POLL":
msg_text = "[{author}](<{url}f/u/{creatorId}>) created a poll [{title}](<{url}f/p/{threadId}>) in {forumName}"
msg_text = _("[{author}](<{url}f/u/{creatorId}>) created a poll [{title}](<{url}f/p/{threadId}>) in {forumName}")
elif thread_funnel != "TEXT":
logger.warning("No entry for {event} with params: {params}".format(event=thread_funnel, params=post))
message = _(msg_text).format(author=post["createdBy"]["name"], url=wiki, creatorId=post["creatorId"], title=post["title"], threadId=post["threadId"], forumName=post["forumName"])
message = msg_text.format(author=post["createdBy"]["name"], url=wiki, creatorId=post["creatorId"], title=post["title"], threadId=post["threadId"], forumName=post["forumName"])
else:
message = _("[{author}](<{url}f/u/{creatorId}>) created a [reply](<{url}f/p/{threadId}/r/{postId}>) to [{title}](<{url}f/p/{threadId}>) in {forumName}").format(author=post["createdBy"]["name"], url=wiki, creatorId=post["creatorId"], threadId=post["threadId"], postId=post["id"], title=post["_embedded"]["thread"][0]["title"], forumName=post["forumName"])
elif post_type == "WALL":

View file

@ -14,7 +14,4 @@ try:
langs["en"][file] = gettext.NullTranslations()
except FileNotFoundError:
logger.critical("No language files have been found. Make sure locale folder is located in the directory.")
raise
sys.exit(1)
#ngettext = en.ngettext