Multilanguage support for /help and /language commands
This commit is contained in:
parent
d888d27ef6
commit
534f5c4229
@ -3,6 +3,6 @@
|
||||
__author__ = "Davide Testa"
|
||||
__email__ = "davide@davte.it"
|
||||
__license__ = "GNU General Public License v3.0"
|
||||
__version__ = "1.0.15"
|
||||
__version__ = "1.1.0"
|
||||
__maintainer__ = "Davide Testa"
|
||||
__contact__ = "t.me/davte"
|
||||
|
@ -20,6 +20,10 @@ language_messages = {
|
||||
'en': "/language",
|
||||
'it': "/lingua"
|
||||
},
|
||||
'reply_keyboard_button': {
|
||||
'en': "Language 🗣",
|
||||
'it': "Lingua 🗣"
|
||||
},
|
||||
'alias': {
|
||||
'en': "Language 🗣",
|
||||
'it': "Lingua 🗣"
|
||||
@ -33,6 +37,10 @@ language_messages = {
|
||||
'description': {
|
||||
'en': "Change language settings",
|
||||
'it': "Cambia le impostazioni della lingua"
|
||||
},
|
||||
'language_set': {
|
||||
'en': "Selected language: English 🇬🇧",
|
||||
'it': "Lingua selezionata: Italiano 🇮🇹"
|
||||
}
|
||||
},
|
||||
'language_panel': {
|
||||
@ -57,29 +65,37 @@ supported_languages = {
|
||||
ciclopibot_help_messages = {
|
||||
'help_command': {
|
||||
'text': {
|
||||
'en': "<b>📖 {bot.name} guide</b>\n\n"
|
||||
"Welcome!\n"
|
||||
"To visit a guide section, press the corresponding "
|
||||
"button.\n"
|
||||
"To view all available commands, see section "
|
||||
"`Comandi`.\n\n"
|
||||
"Bot author and administrator: @Davte",
|
||||
'it': "<b>📖 Guida di {bot.name}\n\n</b>"
|
||||
"Benvenuto!\n"
|
||||
"Per leggere una sezione della guida premi il bottone "
|
||||
"corrispondente. Per conoscere tutti i comandi "
|
||||
"disponibili, visita l'apposita sezione della guida "
|
||||
"premendo il pulsante Comandi.\n\n"
|
||||
"Autore e amministratore del bot: @Davte"
|
||||
},
|
||||
'en': "<b>📖 {bot.name} guide</b>\n\n"
|
||||
"Welcome!\n"
|
||||
"To visit a guide section, press the corresponding button.\n"
|
||||
"To view all available commands, see section `Comandi`.\n\n"
|
||||
"Bot author and administrator: @Davte",
|
||||
'it': "<b>📖 Guida di {bot.name}\n\n</b>"
|
||||
"Benvenuto!\n"
|
||||
"Per leggere una sezione della guida premi il bottone "
|
||||
"corrispondente. Per conoscere tutti i comandi "
|
||||
"disponibili, visita l'apposita sezione della guida "
|
||||
"premendo il pulsante Comandi.\n\n"
|
||||
"Autore e amministratore del bot: @Davte"
|
||||
},
|
||||
'reply_keyboard_button': {
|
||||
'en': "Help 📖",
|
||||
'it': "Guida 📖"
|
||||
},
|
||||
'description': {
|
||||
'en': "Help",
|
||||
'it': "Aiuto"
|
||||
},
|
||||
'access_denied_message': {
|
||||
'en': "Ask for authorization. If your request is accepted, send "
|
||||
"/help command again to read the guide.",
|
||||
'it': "Chiedi di essere autorizzato: se la tua richiesta "
|
||||
"verrà accolta, ripeti il comando /help per leggere "
|
||||
"il messaggio di aiuto."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
path = os.path.dirname(__file__)
|
||||
try:
|
||||
|
@ -20,6 +20,10 @@ default_ciclopi_messages = {
|
||||
'description': {
|
||||
'en': "CiloPi stations status",
|
||||
'it': "Stato delle stazioni CicloPi"
|
||||
},
|
||||
'reply_keyboard_button': {
|
||||
'en': "CicloPi 🚲",
|
||||
'it': "CicloPi 🚲"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1497,6 +1501,8 @@ def init(bot, ciclopi_messages=None):
|
||||
ciclopi_messages = default_ciclopi_messages
|
||||
|
||||
@bot.command(command='/ciclopi', aliases=["CicloPi 🚲", "🚲 CicloPi 🔴"],
|
||||
reply_keyboard_button=default_ciclopi_messages[
|
||||
'ciclopi_command']['reply_keyboard_button'],
|
||||
show_in_keyboard=True,
|
||||
description=(
|
||||
ciclopi_messages['ciclopi_command']['description']
|
||||
|
@ -11,7 +11,11 @@ default_help_messages = {
|
||||
'text': {
|
||||
'en': "<b>Guide</b>",
|
||||
'it': "<b>Guida</b>"
|
||||
},
|
||||
},
|
||||
'reply_keyboard_button': {
|
||||
'en': "Help 📖",
|
||||
'it': "Guida 📖"
|
||||
},
|
||||
'description': {
|
||||
'en': "Help",
|
||||
'it': "Aiuto"
|
||||
@ -215,7 +219,9 @@ def init(bot, help_messages=None,
|
||||
async def start_command(bot, update, user_record):
|
||||
return await _start_command(bot, update, user_record)
|
||||
|
||||
@bot.command(command='/help', aliases=['Guida 📖', '00help'],
|
||||
@bot.command(command='/help', aliases=['Guida 📖', 'Help 📖', '00help'],
|
||||
reply_keyboard_button=help_messages['help_command'][
|
||||
'reply_keyboard_button'],
|
||||
show_in_keyboard=True,
|
||||
description=help_messages['help_command']['description'],
|
||||
authorization_level='everybody')
|
||||
|
Loading…
x
Reference in New Issue
Block a user