2022-03-22 05:43:10 +03:00
|
|
|
import gettext
|
|
|
|
from olgram.settings import BotSettings
|
|
|
|
from os.path import dirname
|
|
|
|
|
|
|
|
locales_dir = dirname(__file__)
|
|
|
|
|
2022-03-22 06:56:39 +03:00
|
|
|
|
|
|
|
def dummy_translator(x: str) -> str:
|
|
|
|
return x
|
|
|
|
|
|
|
|
|
2022-03-22 05:43:10 +03:00
|
|
|
lang = BotSettings.language()
|
|
|
|
if lang == "ru":
|
2022-03-22 06:56:39 +03:00
|
|
|
_ = dummy_translator
|
2022-03-22 05:43:10 +03:00
|
|
|
else:
|
|
|
|
t = gettext.translation("olgram", localedir=locales_dir, languages=[lang])
|
|
|
|
_ = t.gettext
|
2022-04-11 15:51:00 +03:00
|
|
|
|
|
|
|
|
|
|
|
translators = {
|
|
|
|
"ru": dummy_translator,
|
|
|
|
"uk": gettext.translation("olgram", localedir=locales_dir, languages=["uk"]).gettext,
|
|
|
|
"zh": gettext.translation("olgram", localedir=locales_dir, languages=["zh"]).gettext,
|
2022-04-11 18:16:00 +03:00
|
|
|
"en": gettext.translation("olgram", localedir=locales_dir, languages=["en"]).gettext,
|
2022-04-11 17:17:35 +03:00
|
|
|
}
|