Updated locale strings

This commit is contained in:
2023-08-30 11:01:59 +02:00
parent 9cda8859da
commit 9403c087cc
6 changed files with 81 additions and 51 deletions

View File

@@ -22,12 +22,14 @@ async def command_setup(app: PyroClient, message: Message):
keyboard_type = ReplyKeyboard(resize_keyboard=True, row_width=1)
keyboard_type.add(
ReplyButton("Search nearby locations", request_location=True),
ReplyButton("Search by location name"),
ReplyButton(
app._("search_nearby", "buttons", locale=user.locale), request_location=True
),
ReplyButton(app._("search_name", "buttons", locale=user.locale)),
)
await message.reply_text(
"Let's begin configuration with the search for your location.\n\nPlease, select whether you want to search among the locations near you or go straight to the search by location name.\n\nNote that the location you send will **NOT** be saved anywhere and is only used for location lookup in the database.",
app._("setup", "messages", locale=user.locale),
reply_markup=keyboard_type,
)
@@ -41,9 +43,9 @@ async def command_setup(app: PyroClient, message: Message):
)
return
if answer_type.location is None and answer_type.text not in [
"Search by location name",
]:
if answer_type.location is None and answer_type.text not in app.in_all_locales(
"search_name", "buttons"
):
await answer_type.reply_text(
app._("selection_invalid", "messages", locale=user.locale).format(
cancel_notice=app._("cancel", "messages", locale=user.locale)
@@ -61,16 +63,22 @@ async def command_setup(app: PyroClient, message: Message):
if location is None:
await answer_type.reply_text(
"If you want try selecting the location again, use the /setup command.",
app._("setup_retry", "messages", locale=user.locale),
reply_markup=ReplyKeyboardRemove(),
)
return
await user.update_location(location.id)
user_time = datetime(1970, 1, 1, user.time_hour, user.time_minute)
user_time = datetime(1970, 1, 1, user.time_hour, user.time_minute).strftime(
app._("time", "formats", locale=user.locale)
)
await message.reply_text(
f"✅ Finished! Your location is now **{location.name}**. You will receive the notifications about garbage collection {user.offset} d. in advance at {user_time.strftime(app._('time', 'formats', locale=user.locale))}.",
app._("setup_finished", "messages", locale=user.locale).format(
name=location.name,
offset=user.offset,
time=user_time,
),
reply_markup=ReplyKeyboardRemove(),
)