Updated locale strings
This commit is contained in:
parent
9cda8859da
commit
9403c087cc
@ -35,6 +35,10 @@
|
|||||||
"messages": {
|
"messages": {
|
||||||
"cancel": "Use /cancel if you want to cancel this operation.",
|
"cancel": "Use /cancel if you want to cancel this operation.",
|
||||||
"cancelled": "Operation has been cancelled.",
|
"cancelled": "Operation has been cancelled.",
|
||||||
|
"checkout_deleted": "🗑️ Your data has been deleted. If you want to start using this bot again, please use /setup command. Otherwise delete/block the bot and do not interact with it anymore.",
|
||||||
|
"checkout_deletion": "Alright. Please, confirm that you want to delete your data from the bot.\n\nFollowing data will be deleted:\n• Selected location\n• Preferred language of all messages\n• Time of the notifications\n• Offset of the notifications\n\nUse keyboard provided to confirm and continue or /cancel to abort this operation.",
|
||||||
|
"checkout": "Here's pretty much all the data bot has. Please, use these buttons to choose whether you want to delete your data from the bot.",
|
||||||
|
"commands_removed": "✅ All currently registered commands have been unregistered. Commands will be registered again on bot's start.",
|
||||||
"help": "🔔 This bot sends you notifications about garbage collection according to your local schedule.\n\n**Available commands**\n/help - Show this message\n/setup - Select the location\n/toggle - Disable/enable the reminders\n/set_time - Set the reminders' time\n/set_offset - Set offset between reminders and collection\n/upcoming - Show the upcoming collection\n/language - Select the bot's language\n/checkout - Export or remove your data\n\n💭 You can also suggest adding your town/district to the bot by contacting the admins using [this link]({url_contact}) and providing your schedule.\n\n⚙️ Want to host this bot yourself or make some changes? It's open-source, so you can basically fork it. Take a look at [bot's repository]({url_repo}) for details.\n\nHappy using! 🤗",
|
"help": "🔔 This bot sends you notifications about garbage collection according to your local schedule.\n\n**Available commands**\n/help - Show this message\n/setup - Select the location\n/toggle - Disable/enable the reminders\n/set_time - Set the reminders' time\n/set_offset - Set offset between reminders and collection\n/upcoming - Show the upcoming collection\n/language - Select the bot's language\n/checkout - Export or remove your data\n\n💭 You can also suggest adding your town/district to the bot by contacting the admins using [this link]({url_contact}) and providing your schedule.\n\n⚙️ Want to host this bot yourself or make some changes? It's open-source, so you can basically fork it. Take a look at [bot's repository]({url_repo}) for details.\n\nHappy using! 🤗",
|
||||||
"import_finished": "You have successfully inserted {count} entries.",
|
"import_finished": "You have successfully inserted {count} entries.",
|
||||||
"import_invalid_date": "Entries contain invalid date formats. Use **ISO 8601** date format.",
|
"import_invalid_date": "Entries contain invalid date formats. Use **ISO 8601** date format.",
|
||||||
@ -42,42 +46,53 @@
|
|||||||
"import_invalid": "This is not a valid garbage collection JSON.",
|
"import_invalid": "This is not a valid garbage collection JSON.",
|
||||||
"import": "Alright. Send me a valid JSON.",
|
"import": "Alright. Send me a valid JSON.",
|
||||||
"locale_choice": "Alright. Please choose the language using keyboard below.",
|
"locale_choice": "Alright. Please choose the language using keyboard below.",
|
||||||
|
"location_name_empty": "Could not find any locations by this name. Try rephrasing it or make sure you use the same location language and name itself as it in written by your local authorities in garbage collection schedule.\n\n{cancel_notice}",
|
||||||
|
"location_name_invalid": "Please, send the name of the location as a text. {cancel_notice}",
|
||||||
|
"location_name": "Please, send me a location name. It should be the name used in your local authorities' garbage collection schedule. This usually is a name of the district or even the town itself.",
|
||||||
|
"location_select": "Select the location using the keyboard provided.",
|
||||||
|
"reminder": "**Garbage Collection**\n\nType: {type}\nDate: {date}\n\nDon't forget to prepare your bin for collection!",
|
||||||
|
"search_nearby_empty": "Could not find any locations nearby. Let's try using the name search.",
|
||||||
|
"selection_invalid": "Please, select a valid option using the keyboard provided. {cancel_notice}",
|
||||||
|
"set_offset_finished": "🔔 Notifications offset has been updated! You will now receive notification about collection **{offset} d.** before the collection at {time}. {toggle_notice}",
|
||||||
|
"set_offset_invalid": "Please, provide a valid integer number of days in range 0 to 7 (inclusive). {cancel_notice}",
|
||||||
|
"set_offset": "Alright. Please, send how many days in advance do you want to get a notification about the collection.",
|
||||||
|
"set_time_finished": "🔔 Notifications time has been updated! You will now receive notification about collection {offset} d. before the collection at **{time}**. {toggle_notice}",
|
||||||
|
"set_time_invalid": "Please, provide a valid time in HH:MM format. {cancel_notice}",
|
||||||
|
"set_time": "Alright. Please, send your desired time in HH:MM format.",
|
||||||
|
"setup_finished": "✅ Finished! Your location is now **{name}**. You will receive the notifications about garbage collection {offset} d. in advance at {time}.",
|
||||||
|
"setup_retry": "ℹ️ If you want try selecting the location again, use the /setup command.",
|
||||||
|
"setup": "⚙️ 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.",
|
||||||
"start_code_invalid": "🚫 You have started the bot by the link containing a location, but it does not seem to be a valid one. Please, use the command /setup to manually configure the location.",
|
"start_code_invalid": "🚫 You have started the bot by the link containing a location, but it does not seem to be a valid one. Please, use the command /setup to manually configure the location.",
|
||||||
"start_code": "ℹ️ You have started the bot by the link containing a location **{name}**.\n\nPlease, confirm whether you want to use it as your location.",
|
"start_code": "ℹ️ You have started the bot by the link containing a location **{name}**.\n\nPlease, confirm whether you want to use it as your location.",
|
||||||
"start_configure": "📍 Let's configure your location. Press the button on pop-up keyboard to start the process.",
|
"start_configure": "📍 Let's configure your location. Press the button on pop-up keyboard to start the process.",
|
||||||
"selection_invalid": "Please, select a valid option using the keyboard provided. {cancel_notice}",
|
|
||||||
"start_selection_no": "Alright, you're on your own now. Please, use the command /setup to configure your location and start receiving reminders.",
|
"start_selection_no": "Alright, you're on your own now. Please, use the command /setup to configure your location and start receiving reminders.",
|
||||||
"start_selection_yes": "✅ Finished! Your location is now **{name}**. You will receive reminders about garbage collection {offset} d. in advance at {time}.\n\nPlease, visit /help if you want to know how to change notifications time or disable them.",
|
"start_selection_yes": "✅ Finished! Your location is now **{name}**. You will receive reminders about garbage collection {offset} d. in advance at {time}.\n\nPlease, visit /help if you want to know how to change notifications time or disable them.",
|
||||||
"start": "👋 Welcome!\n\nThis small open-source bot is made to simplify your life a bit easier by sending you notifications about upcoming garbage collection in your location.\n\nBy using this bot you accept [Privacy Policy]({privacy_policy}), otherwise please block and remove this bot before further interaction.\n\nNow the official part is over so you can dive into the bot.",
|
"start": "👋 Welcome!\n\nThis small open-source bot is made to simplify your life a bit easier by sending you notifications about upcoming garbage collection in your location.\n\nBy using this bot you accept [Privacy Policy]({privacy_policy}), otherwise please block and remove this bot before further interaction.\n\nNow the official part is over so you can dive into the bot.",
|
||||||
"checkout_deleted": "🗑️ Your data has been deleted. If you want to start using this bot again, please use /setup command. Otherwise delete/block the bot and do not interact with it anymore.",
|
|
||||||
"checkout": "Here's pretty much all the data bot has. Please, use these buttons to choose whether you want to delete your data from the bot.",
|
|
||||||
"checkout_deletion": "Alright. Please, confirm that you want to delete your data from the bot.\n\nFollowing data will be deleted:\n• Selected location\n• Preferred language of all messages\n• Time of the notifications\n• Offset of the notifications\n\nUse keyboard provided to confirm and continue or /cancel to abort this operation.",
|
|
||||||
"toggle_disabled": "🔕 Notifications have been disabled.",
|
"toggle_disabled": "🔕 Notifications have been disabled.",
|
||||||
"toggle_enabled": "🔔 Notifications have been enabled {offset} d. before garbage collection at {time}. Use /setup to select your location.",
|
|
||||||
"toggle_enabled_location": "🔔 Notifications have been enabled {offset} d. before garbage collection at {time} at the **{name}**.",
|
"toggle_enabled_location": "🔔 Notifications have been enabled {offset} d. before garbage collection at {time} at the **{name}**.",
|
||||||
|
"toggle_enabled": "🔔 Notifications have been enabled {offset} d. before garbage collection at {time}. Use /setup to select your location.",
|
||||||
|
"toggle": "Execute /toggle to enable notifications.",
|
||||||
"upcoming_empty_location": "You have no location set. Use /setup to select your location.",
|
"upcoming_empty_location": "You have no location set. Use /setup to select your location.",
|
||||||
"upcoming_empty": "No garbage collection entries found for the next 30 days at **{name}**",
|
"upcoming_empty": "No garbage collection entries found for the next 30 days at **{name}**",
|
||||||
"upcoming": "Upcoming garbage collection:\n\n{entries}",
|
"upcoming": "Upcoming garbage collection:\n\n{entries}"
|
||||||
"reminder": "**Garbage Collection**\n\nType: {type}\nDate: {date}\n\nDon't forget to prepare your bin for collection!",
|
|
||||||
"search_nearby_empty": "Could not find any locations nearby. Let's try using the name search.",
|
|
||||||
"location_select": "Select the location using the keyboard provided.",
|
|
||||||
"location_name": "Please, send me a location name. It should be the name used in your local authorities' garbage collection schedule. This usually is a name of the district or even the town itself.",
|
|
||||||
"location_name_invalid": "Please, send the name of the location as a text. {cancel_notice}",
|
|
||||||
"location_name_empty": "Could not find any locations by this name. Try rephrasing it or make sure you use the same location language and name itself as it in written by your local authorities in garbage collection schedule.\n\n{cancel_notice}"
|
|
||||||
},
|
},
|
||||||
"buttons": {
|
"buttons": {
|
||||||
"start_configure": "⚙️ Let's configure the bot",
|
"delete_confirm": "I agree and want to proceed",
|
||||||
"start_code_yes": "✅ Yes, I want to use it",
|
|
||||||
"start_code_no": "❌ No, I don't want to use it",
|
|
||||||
"delete_yes": "✅ Yes, I want to delete it",
|
|
||||||
"delete_no": "❌ No, I don't want to delete it",
|
"delete_no": "❌ No, I don't want to delete it",
|
||||||
"delete_confirm": "I agree and want to proceed"
|
"delete_yes": "✅ Yes, I want to delete it",
|
||||||
|
"search_name": "🔎 Search by location name",
|
||||||
|
"search_nearby": "📍 Search nearby locations",
|
||||||
|
"start_code_no": "❌ No, I don't want to use it",
|
||||||
|
"start_code_yes": "✅ Yes, I want to use it",
|
||||||
|
"start_configure": "⚙️ Let's configure the bot"
|
||||||
},
|
},
|
||||||
"callbacks": {
|
"callbacks": {
|
||||||
"locale_set": "Your language now is: {locale}"
|
"locale_set": "Your language now is: {locale}"
|
||||||
},
|
},
|
||||||
"force_replies": {
|
"force_replies": {
|
||||||
"import": "JSON with garbage entries",
|
"import": "JSON with garbage entries",
|
||||||
"location_name": "Location name"
|
"location_name": "Location name",
|
||||||
|
"set_offset": "Number of days",
|
||||||
|
"set_time": "Time as HH:MM"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +0,0 @@
|
|||||||
from pyrogram import filters
|
|
||||||
from pyrogram.types import CallbackQuery
|
|
||||||
|
|
||||||
from classes.pyroclient import PyroClient
|
|
||||||
|
|
||||||
|
|
||||||
@PyroClient.on_callback_query(filters.regex("nothing")) # type: ignore
|
|
||||||
async def callback_nothing(app: PyroClient, callback: CallbackQuery):
|
|
||||||
await callback.answer(
|
|
||||||
text=app._("nothing", "callbacks", locale=callback.from_user.language_code)
|
|
||||||
)
|
|
@ -8,5 +8,7 @@ from classes.pyroclient import PyroClient
|
|||||||
~filters.scheduled & filters.private & filters.command(["remove_commands"], prefixes=["/"]) # type: ignore
|
~filters.scheduled & filters.private & filters.command(["remove_commands"], prefixes=["/"]) # type: ignore
|
||||||
)
|
)
|
||||||
async def command_remove_commands(app: PyroClient, message: Message):
|
async def command_remove_commands(app: PyroClient, message: Message):
|
||||||
await message.reply_text("Okay.")
|
user = await app.find_user(message.from_user)
|
||||||
|
|
||||||
|
await message.reply_text(app._("commands_removed", "messages", locale=user.locale))
|
||||||
await app.remove_commands(command_sets=await app.collect_commands())
|
await app.remove_commands(command_sets=await app.collect_commands())
|
||||||
|
@ -17,8 +17,10 @@ async def command_set_offset(app: PyroClient, message: Message):
|
|||||||
user = await app.find_user(message.from_user)
|
user = await app.find_user(message.from_user)
|
||||||
|
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
"Alright. Please, send how many days in advance do you want to get a notification about the collection.",
|
app._("set_offset", "messages", locale=user.locale),
|
||||||
reply_markup=ForceReply(placeholder="Number of days"),
|
reply_markup=ForceReply(
|
||||||
|
placeholder=app._("set_offset", "force_replies", locale=user.locale)
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@ -39,7 +41,9 @@ async def command_set_offset(app: PyroClient, message: Message):
|
|||||||
)
|
)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
await answer.reply_text(
|
await answer.reply_text(
|
||||||
"Please, provide a valid integer number of days in range 0 to 7 (inclusive). Use /cancel if you want to cancel this operation."
|
app._("set_offset_invalid", "messages", locale=user.locale).format(
|
||||||
|
cancel_notice=app._("cancel", "messages", locale=user.locale)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -51,13 +55,17 @@ async def command_set_offset(app: PyroClient, message: Message):
|
|||||||
|
|
||||||
logger.info("User %s has set offset to %s", user.id, offset)
|
logger.info("User %s has set offset to %s", user.id, offset)
|
||||||
|
|
||||||
notice = "" if user.enabled else "Execute /toggle to enable notifications."
|
|
||||||
|
|
||||||
garbage_time = datetime(
|
garbage_time = datetime(
|
||||||
1970, 1, 1, hour=user.time_hour, minute=user.time_minute
|
1970, 1, 1, hour=user.time_hour, minute=user.time_minute
|
||||||
).strftime(app._("time", "formats"))
|
).strftime(app._("time", "formats"))
|
||||||
|
|
||||||
await answer.reply_text(
|
await answer.reply_text(
|
||||||
f"Notifications time has been updated! You will now receive notification about collection **{offset} d.** before the collection at {garbage_time}. {notice}",
|
app._("set_offset_finished", "messages", locale=user.locale).format(
|
||||||
|
offset=offset,
|
||||||
|
time=garbage_time,
|
||||||
|
toggle_notice=""
|
||||||
|
if user.enabled
|
||||||
|
else app._("toggle", "messages", locale=user.locale),
|
||||||
|
),
|
||||||
reply_markup=ReplyKeyboardRemove(),
|
reply_markup=ReplyKeyboardRemove(),
|
||||||
)
|
)
|
||||||
|
@ -17,8 +17,10 @@ async def command_set_time(app: PyroClient, message: Message):
|
|||||||
user = await app.find_user(message.from_user)
|
user = await app.find_user(message.from_user)
|
||||||
|
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
"Alright. Please, send your desired time in HH:MM format.",
|
app._("set_time", "messages", locale=user.locale),
|
||||||
reply_markup=ForceReply(placeholder="Time as HH:MM"),
|
reply_markup=ForceReply(
|
||||||
|
placeholder=app._("set_time", "force_replies", locale=user.locale)
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@ -35,7 +37,9 @@ async def command_set_time(app: PyroClient, message: Message):
|
|||||||
datetime.strptime(answer.text, "%H:%M")
|
datetime.strptime(answer.text, "%H:%M")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
await answer.reply_text(
|
await answer.reply_text(
|
||||||
"Please, provide a valid time in HH:MM format. Use /cancel if you want to cancel this operation."
|
app._("set_time_invalid", "messages", locale=user.locale).format(
|
||||||
|
cancel_notice=app._("cancel", "messages", locale=user.locale)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -51,11 +55,15 @@ async def command_set_time(app: PyroClient, message: Message):
|
|||||||
user_time.strftime("%H:%M"),
|
user_time.strftime("%H:%M"),
|
||||||
)
|
)
|
||||||
|
|
||||||
notice = "" if user.enabled else "Execute /toggle to enable notifications."
|
|
||||||
|
|
||||||
garbage_time = user_time.strftime(app._("time", "formats"))
|
garbage_time = user_time.strftime(app._("time", "formats"))
|
||||||
|
|
||||||
await answer.reply_text(
|
await answer.reply_text(
|
||||||
f"Notifications time has been updated! You will now receive notification about collection {user.offset} d. before the collection at **{garbage_time}**. {notice}",
|
app._("set_time_finished", "messages", locale=user.locale).format(
|
||||||
|
offset=user.offset,
|
||||||
|
time=garbage_time,
|
||||||
|
toggle_notice=""
|
||||||
|
if user.enabled
|
||||||
|
else app._("toggle", "messages", locale=user.locale),
|
||||||
|
),
|
||||||
reply_markup=ReplyKeyboardRemove(),
|
reply_markup=ReplyKeyboardRemove(),
|
||||||
)
|
)
|
||||||
|
@ -22,12 +22,14 @@ async def command_setup(app: PyroClient, message: Message):
|
|||||||
|
|
||||||
keyboard_type = ReplyKeyboard(resize_keyboard=True, row_width=1)
|
keyboard_type = ReplyKeyboard(resize_keyboard=True, row_width=1)
|
||||||
keyboard_type.add(
|
keyboard_type.add(
|
||||||
ReplyButton("Search nearby locations", request_location=True),
|
ReplyButton(
|
||||||
ReplyButton("Search by location name"),
|
app._("search_nearby", "buttons", locale=user.locale), request_location=True
|
||||||
|
),
|
||||||
|
ReplyButton(app._("search_name", "buttons", locale=user.locale)),
|
||||||
)
|
)
|
||||||
|
|
||||||
await message.reply_text(
|
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,
|
reply_markup=keyboard_type,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,9 +43,9 @@ async def command_setup(app: PyroClient, message: Message):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if answer_type.location is None and answer_type.text not in [
|
if answer_type.location is None and answer_type.text not in app.in_all_locales(
|
||||||
"Search by location name",
|
"search_name", "buttons"
|
||||||
]:
|
):
|
||||||
await answer_type.reply_text(
|
await answer_type.reply_text(
|
||||||
app._("selection_invalid", "messages", locale=user.locale).format(
|
app._("selection_invalid", "messages", locale=user.locale).format(
|
||||||
cancel_notice=app._("cancel", "messages", locale=user.locale)
|
cancel_notice=app._("cancel", "messages", locale=user.locale)
|
||||||
@ -61,16 +63,22 @@ async def command_setup(app: PyroClient, message: Message):
|
|||||||
|
|
||||||
if location is None:
|
if location is None:
|
||||||
await answer_type.reply_text(
|
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(),
|
reply_markup=ReplyKeyboardRemove(),
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
await user.update_location(location.id)
|
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(
|
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(),
|
reply_markup=ReplyKeyboardRemove(),
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user