WIP: Locale strings

This commit is contained in:
2023-08-29 16:32:37 +02:00
parent 029a965860
commit 9cda8859da
14 changed files with 214 additions and 78 deletions

View File

@@ -15,15 +15,26 @@ async def command_toggle(app: PyroClient, message: Message):
await user.update_state(not user.enabled)
if user.enabled:
await message.reply_text("Notifications have been disabled.")
await message.reply_text(
app._("toggle_disabled", "messages", locale=user.locale)
)
return
user_time = datetime(1970, 1, 1, user.time_hour, user.time_minute).strftime("%H:%M")
if user.location is None:
await message.reply_text(
f"Notifications have been enabled {user.offset} d. before garbage collection at {datetime(1970, 1, 1, user.time_hour, user.time_minute).strftime('%H:%M')}. Use /setup to select your location."
app._("toggle_enabled", "messages", locale=user.locale).format(
offset=user.offset,
time=user_time,
),
)
return
await message.reply_text(
f"Notifications have been enabled {user.offset} d. before garbage collection at {datetime(1970, 1, 1, user.time_hour, user.time_minute).strftime('%H:%M')} at the **{user.location.name}**."
app._("toggle_enabled_location", "messages", locale=user.locale).format(
offset=user.offset,
time=user_time,
name=user.location.name,
)
)