mirror of
https://github.com/civsocit/olgram.git
synced 2023-07-22 01:29:12 +03:00
24 lines
572 B
Python
24 lines
572 B
Python
import gettext
|
|
from olgram.settings import BotSettings
|
|
from os.path import dirname
|
|
|
|
locales_dir = dirname(__file__)
|
|
|
|
|
|
def dummy_translator(x: str) -> str:
|
|
return x
|
|
|
|
|
|
lang = BotSettings.language()
|
|
if lang == "ru":
|
|
_ = dummy_translator
|
|
else:
|
|
t = gettext.translation("olgram", localedir=locales_dir, languages=[lang])
|
|
_ = t.gettext
|
|
|
|
|
|
translators = {
|
|
"ru": dummy_translator,
|
|
"uk": gettext.translation("olgram", localedir=locales_dir, languages=["uk"]).gettext,
|
|
"zh": gettext.translation("olgram", localedir=locales_dir, languages=["zh"]).gettext,
|
|
} |