mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -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:
@@ -12,6 +12,7 @@ from redbot.core import Config, modlog, commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils._internal_utils import send_to_owners_with_prefix_replaced
|
||||
from redbot.core.utils.chat_formatting import inline
|
||||
from .events import Events
|
||||
from .kickban import KickBanMixin
|
||||
from .names import ModInfo
|
||||
@@ -141,8 +142,8 @@ class Mod(
|
||||
if e["ignored"] is not False:
|
||||
msg = _(
|
||||
"Ignored guilds and channels have been moved. "
|
||||
"Please use `[p]moveignoredchannels` to migrate the old settings."
|
||||
)
|
||||
"Please use {command} to migrate the old settings."
|
||||
).format(command=inline("[p]moveignoredchannels"))
|
||||
self.bot.loop.create_task(send_to_owners_with_prefix_replaced(self.bot, msg))
|
||||
message_sent = True
|
||||
break
|
||||
@@ -151,8 +152,8 @@ class Mod(
|
||||
if e["ignored"] is not False:
|
||||
msg = _(
|
||||
"Ignored guilds and channels have been moved. "
|
||||
"Please use `[p]moveignoredchannels` to migrate the old settings."
|
||||
)
|
||||
"Please use {command} to migrate the old settings."
|
||||
).format(command=inline("[p]moveignoredchannels"))
|
||||
self.bot.loop.create_task(
|
||||
send_to_owners_with_prefix_replaced(self.bot, msg)
|
||||
)
|
||||
@@ -163,8 +164,8 @@ class Mod(
|
||||
if e["delete_delay"] != -1:
|
||||
msg = _(
|
||||
"Delete delay settings have been moved. "
|
||||
"Please use `[p]movedeletedelay` to migrate the old settings."
|
||||
)
|
||||
"Please use {command} to migrate the old settings."
|
||||
).format(command=inline("[p]movedeletedelay"))
|
||||
self.bot.loop.create_task(send_to_owners_with_prefix_replaced(self.bot, msg))
|
||||
break
|
||||
await self.config.version.set("1.2.0")
|
||||
|
||||
@@ -336,15 +336,15 @@ class ModSettings(MixinMeta):
|
||||
if not cur_setting:
|
||||
await self.config.guild(guild).reinvite_on_unban.set(True)
|
||||
await ctx.send(
|
||||
_("Users unbanned with `{command}` will be reinvited.").format(
|
||||
command=f"{ctx.clean_prefix}unban"
|
||||
_("Users unbanned with {command} will be reinvited.").format(
|
||||
command=inline(f"{ctx.clean_prefix}unban")
|
||||
)
|
||||
)
|
||||
else:
|
||||
await self.config.guild(guild).reinvite_on_unban.set(False)
|
||||
await ctx.send(
|
||||
_("Users unbanned with `{command}` will not be reinvited.").format(
|
||||
command=f"{ctx.clean_prefix}unban"
|
||||
_("Users unbanned with {command} will not be reinvited.").format(
|
||||
command=inline(f"{ctx.clean_prefix}unban")
|
||||
)
|
||||
)
|
||||
|
||||
@@ -463,7 +463,7 @@ class ModSettings(MixinMeta):
|
||||
msg = _(
|
||||
"All name changes will no longer be tracked.\n"
|
||||
"To delete existing name data, use {command}."
|
||||
).format(command=f"`{ctx.clean_prefix}modset deletenames`")
|
||||
).format(command=inline(f"{ctx.clean_prefix}modset deletenames"))
|
||||
await self.config.track_all_names.set(enabled)
|
||||
await ctx.send(msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user