Introduced i18n to CogStage

This commit is contained in:
2025-05-03 00:38:13 +02:00
parent 327dcba544
commit 34a506466d
2 changed files with 11 additions and 11 deletions

View File

@@ -115,8 +115,7 @@ class CogStage(Cog):
media=[] if media is None else processed_media, media=[] if media is None else processed_media,
) )
# TODO Make a nice message await ctx.respond(self.bot._("stage_created", "messages", locale=ctx.locale))
await ctx.respond("Event stage has been created.")
@command_group.command( @command_group.command(
name="edit", name="edit",
@@ -216,13 +215,11 @@ class CogStage(Cog):
try: try:
event_stage: PycordEventStage = await self.bot.find_event_stage(stage) event_stage: PycordEventStage = await self.bot.find_event_stage(stage)
except (InvalidId, EventStageNotFoundError): except (InvalidId, EventStageNotFoundError):
# TODO Make a nice message await ctx.respond(self.bot._("stage_not_found", "messages", locale=ctx.locale))
await ctx.respond("Event stage was not found.")
return return
if order is not None and order > len(pycord_event.stage_ids): if order is not None and order > len(pycord_event.stage_ids):
# TODO Make a nice message await ctx.respond(self.bot._("stage_sequence_out_of_range", "messages", locale=ctx.locale))
await ctx.respond("Stage sequence out of range.")
return return
processed_media: List[Dict[str, Any]] = ( processed_media: List[Dict[str, Any]] = (
@@ -239,7 +236,7 @@ class CogStage(Cog):
if order is not None and order - 1 != event_stage.sequence: if order is not None and order - 1 != event_stage.sequence:
await pycord_event.reorder_stage(self.bot, event_stage._id, order - 1, cache=self.bot.cache) await pycord_event.reorder_stage(self.bot, event_stage._id, order - 1, cache=self.bot.cache)
await ctx.respond("Event stage has been updated.") await ctx.respond(self.bot._("stage_updated", "messages", locale=ctx.locale))
@command_group.command( @command_group.command(
name="delete", name="delete",
@@ -300,15 +297,13 @@ class CogStage(Cog):
try: try:
event_stage: PycordEventStage = await self.bot.find_event_stage(stage) event_stage: PycordEventStage = await self.bot.find_event_stage(stage)
except (InvalidId, EventStageNotFoundError): except (InvalidId, EventStageNotFoundError):
# TODO Make a nice message await ctx.respond(self.bot._("stage_not_found", "messages", locale=ctx.locale))
await ctx.respond("Event stage was not found.")
return return
await pycord_event.remove_stage(self.bot, event_stage._id, cache=self.bot.cache) await pycord_event.remove_stage(self.bot, event_stage._id, cache=self.bot.cache)
await event_stage.purge(cache=self.bot.cache) await event_stage.purge(cache=self.bot.cache)
# TODO Make a nice message await ctx.respond(self.bot._("stage_deleted", "messages", locale=ctx.locale))
await ctx.respond("Event stage has been deleted.")
def setup(bot: PycordBot) -> None: def setup(bot: PycordBot) -> None:

View File

@@ -28,7 +28,12 @@
"register_already_registered": "You are already registered for this event.", "register_already_registered": "You are already registered for this event.",
"register_success_ongoing": "You are now registered for the event **{event_name}**.\n\nNew channel has been created for you and further instructions will are provided in it. Good luck!", "register_success_ongoing": "You are now registered for the event **{event_name}**.\n\nNew channel has been created for you and further instructions will are provided in it. Good luck!",
"register_success_scheduled": "You are now registered for the event **{event_name}**.\n\nNew channel will be created for you and further instructions will be provided as soon as the event starts <t:{event_starts}:R>. Good luck!", "register_success_scheduled": "You are now registered for the event **{event_name}**.\n\nNew channel will be created for you and further instructions will be provided as soon as the event starts <t:{event_starts}:R>. Good luck!",
"stage_created": "Event stage has been created.",
"stage_deleted": "Event stage has been deleted.",
"stage_entry": "**Stage {sequence}**\nAnswer: ||{answer}||", "stage_entry": "**Stage {sequence}**\nAnswer: ||{answer}||",
"stage_not_found": "Event stage was not found.",
"stage_sequence_out_of_range": "Stage sequence out of range.",
"stage_updated": "Event stage has been updated.",
"status": "**QuizBot** v{version}\n\nUptime: since <t:{start_time}>", "status": "**QuizBot** v{version}\n\nUptime: since <t:{start_time}>",
"status_git": "**QuizBot** v{version} (`{commit}`)\n\nUptime: up since <t:{start_time}>", "status_git": "**QuizBot** v{version} (`{commit}`)\n\nUptime: up since <t:{start_time}>",
"timezone_invalid": "Timezone **{timezone}** was not found. Please, select one of the timezones provided by the autocompletion.", "timezone_invalid": "Timezone **{timezone}** was not found. Please, select one of the timezones provided by the autocompletion.",