Multilanguage support for ciclopibot
This commit is contained in:
parent
a581206d7c
commit
44857fd45f
@ -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.3"
|
__version__ = "1.0.4"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
@ -7,7 +7,7 @@ import sys
|
|||||||
|
|
||||||
# Third party modules
|
# Third party modules
|
||||||
import davtelepot
|
import davtelepot
|
||||||
from davtelepot import authorization
|
from davtelepot import authorization, languages
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from . import bot_tools
|
from . import bot_tools
|
||||||
@ -15,6 +15,47 @@ from . import ciclopi
|
|||||||
from . import helper
|
from . import helper
|
||||||
from .data.passwords import bot_token
|
from .data.passwords import bot_token
|
||||||
|
|
||||||
|
language_messages = {
|
||||||
|
'language_command': {
|
||||||
|
'name': {
|
||||||
|
'en': "/language",
|
||||||
|
'it': "/lingua"
|
||||||
|
},
|
||||||
|
'alias': {
|
||||||
|
'en': "Language 🗣",
|
||||||
|
'it': "Lingua 🗣"
|
||||||
|
},
|
||||||
|
'description': {
|
||||||
|
'en': "Change language settings",
|
||||||
|
'it': "Cambia le impostazioni della lingua"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'language_button': {
|
||||||
|
'description': {
|
||||||
|
'en': "Change language settings",
|
||||||
|
'it': "Cambia le impostazioni della lingua"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'language_panel': {
|
||||||
|
'text': {
|
||||||
|
'en': "<b>Choose a language</b>",
|
||||||
|
'it': "<b>Seleziona una lingua</b>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
supported_languages = {
|
||||||
|
'en': {
|
||||||
|
'flag': '🇬🇧',
|
||||||
|
'name': 'English'
|
||||||
|
},
|
||||||
|
'it': {
|
||||||
|
'flag': '🇮🇹',
|
||||||
|
'name': 'Italiano'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
path = os.path.dirname(__file__)
|
path = os.path.dirname(__file__)
|
||||||
try:
|
try:
|
||||||
@ -88,6 +129,10 @@ if __name__ == '__main__':
|
|||||||
help_sections_file='ciclopibot/data/help.json'
|
help_sections_file='ciclopibot/data/help.json'
|
||||||
)
|
)
|
||||||
authorization.init(bot, language='it')
|
authorization.init(bot, language='it')
|
||||||
|
languages.init(
|
||||||
|
bot, language='it', language_messages=language_messages,
|
||||||
|
supported_languages=supported_languages
|
||||||
|
)
|
||||||
# Run bot(s)
|
# Run bot(s)
|
||||||
logging.info("Presso ctrl+C to exit.")
|
logging.info("Presso ctrl+C to exit.")
|
||||||
exit_state = davtelepot.bot.Bot.run(
|
exit_state = davtelepot.bot.Bot.run(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user