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