olgram/locales/locale.py

13 lines
287 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__)
lang = BotSettings.language()
if lang == "ru":
_ = lambda x: x
else:
t = gettext.translation("olgram", localedir=locales_dir, languages=[lang])
_ = t.gettext