Introduced i18n to utility modules

This commit is contained in:
2025-05-03 00:45:22 +02:00
parent 34a506466d
commit aa2f90e1c5
3 changed files with 14 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ from datetime import datetime
from zoneinfo import ZoneInfo
from discord import ApplicationContext
from libbot.i18n import _
async def is_operation_confirmed(ctx: ApplicationContext, confirm: bool) -> bool:
@@ -17,8 +18,7 @@ async def is_event_status_valid(
event: "PycordEvent",
) -> bool:
if event.is_cancelled:
# TODO Make a nice message
await ctx.respond("This event was cancelled.")
await ctx.respond(_("event_is_cancelled", "messages", locale=ctx.locale))
return False
if (
@@ -26,8 +26,7 @@ async def is_event_status_valid(
<= datetime.now(tz=ZoneInfo("UTC"))
<= event.ends.replace(tzinfo=ZoneInfo("UTC"))
):
# TODO Make a nice message
await ctx.respond("Ongoing events cannot be modified.")
await ctx.respond(_("event_ongoing_not_editable", "messages", locale=ctx.locale))
return False
return True