1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-22 05:54:18 +00:00

Add language switcher

This commit is contained in:
Darren 2020-02-04 15:13:14 +02:00
parent 2d8c36fdca
commit 49cc2b8036
6 changed files with 17 additions and 6 deletions

View file

@ -8,6 +8,8 @@
version = 13
; Set this to no when you are done editing the file
is_template = yes
; Language code for string file
language = it_IT
# Telegram bot parameters
[Telegram]

View file

@ -1,11 +1,13 @@
import sys
import telegram
import strings
import worker
import configloader
import utils
import threading
import importlib
language = configloader.config["Config"]["language"]
strings = importlib.import_module("strings." + language)
def main():
"""The core code of the program. Should be run only in the main process!"""

View file

@ -5,9 +5,12 @@ from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.ext.declarative import declarative_base
import configloader
import telegram
import strings
import requests
import utils
import importlib
language = configloader.config["Config"]["language"]
strings = importlib.import_module("strings." + language)
# Create a (lazy) database engine
engine = create_engine(configloader.config["Database"]["engine"])

View file

@ -2,11 +2,13 @@ import telegram
import telegram.error
import time
from configloader import config
from strings import currency_format_string, currency_symbol
import typing
import os
import sys
import strings
import importlib
language = config["Config"]["language"]
strings = importlib.import_module("strings." + language)
if config["Error Reporting"]["sentry_token"] != \
"https://00000000000000000000000000000000:00000000000000000000000000000000@sentry.io/0000000":
@ -40,7 +42,7 @@ class Price:
return f"<Price of value {self.value}>"
def __str__(self):
return currency_format_string.format(symbol=currency_symbol,
return strings.currency_format_string.format(symbol=strings.currency_symbol,
value="{0:.2f}".format(
self.value / (10 ** int(config["Payments"]["currency_exp"]))))

View file

@ -3,7 +3,6 @@ import typing
import uuid
import datetime
import telegram
import strings
import configloader
import sys
import queue as queuem
@ -13,7 +12,10 @@ import utils
import os
from html import escape
import requests
import importlib
language = configloader.config["Config"]["language"]
strings = importlib.import_module("strings." + language)
class StopSignal:
"""A data class that should be sent to the worker when the conversation has to be stopped abnormally."""