mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
[Core/Core Cogs] Prevent translation errors and use formatting utils (#5435)
* Use proper syntax for inline formatting in core_commands * use proper formating utils in core and core cogs wherever reasonable * tests are awesome * ensure "(continued)" is translated in help.py * add colons to translatable strings for easier context comprehension by translators * Thx flame :) Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com> * good point Co-authored-by: Dav <dav@mail.stopdavabuse.de> Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
@@ -15,7 +15,7 @@ from .utils.common_filters import (
|
||||
filter_urls,
|
||||
escape_spoilers,
|
||||
)
|
||||
from .utils.chat_formatting import pagify
|
||||
from .utils.chat_formatting import bold, pagify
|
||||
from .i18n import Translator, set_contextual_locales_from_guild
|
||||
|
||||
from .generic_casetypes import all_generics
|
||||
@@ -486,7 +486,7 @@ class Case:
|
||||
|
||||
if embed:
|
||||
if self.reason:
|
||||
reason = _("**Reason:** {}").format(self.reason)
|
||||
reason = f"{bold(_('Reason:'))} {self.reason}"
|
||||
if len(reason) > 2048:
|
||||
reason = (
|
||||
next(
|
||||
@@ -521,7 +521,7 @@ class Case:
|
||||
return emb
|
||||
else:
|
||||
if self.reason:
|
||||
reason = _("**Reason:** {}").format(self.reason)
|
||||
reason = f"{bold(_('Reason:'))} {self.reason}"
|
||||
if len(reason) > 1000:
|
||||
reason = (
|
||||
next(
|
||||
@@ -536,20 +536,20 @@ class Case:
|
||||
user = filter_mass_mentions(filter_urls(user)) # Further sanitization outside embeds
|
||||
case_text = ""
|
||||
case_text += "{}\n".format(title)
|
||||
case_text += _("**User:** {}\n").format(user)
|
||||
case_text += _("**Moderator:** {}\n").format(moderator)
|
||||
case_text += f"{bold(_('User:'))} {user}\n"
|
||||
case_text += f"{bold(_('Moderator:'))} {moderator}\n"
|
||||
case_text += "{}\n".format(reason)
|
||||
if until and duration:
|
||||
case_text += _("**Until:** {}\n**Duration:** {}\n").format(until, duration)
|
||||
case_text += f"{bold(_('Until:'))} {until}\n{bold(_('Duration:'))} {duration}\n"
|
||||
if self.channel:
|
||||
if isinstance(self.channel, int):
|
||||
case_text += _("**Channel**: {} (Deleted)\n").format(self.channel)
|
||||
case_text += f"{bold(_('Channel:'))} {self.channel} {_('(Deleted)')}\n"
|
||||
else:
|
||||
case_text += _("**Channel**: {}\n").format(self.channel.name)
|
||||
case_text += f"{bold(_('Channel:'))} {self.channel.name}\n"
|
||||
if amended_by:
|
||||
case_text += _("**Amended by:** {}\n").format(amended_by)
|
||||
case_text += f"{bold(_('Amended by:'))} {amended_by}\n"
|
||||
if last_modified:
|
||||
case_text += _("**Last modified at:** {}\n").format(last_modified)
|
||||
case_text += f"{bold(_('Last modified at:'))} {last_modified}\n"
|
||||
return case_text.strip()
|
||||
|
||||
def to_json(self) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user