olgram/locales/locale.py

18 lines
345 B
Python
Raw Normal View History

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