tuxbot-bot/cogs/utils/lang.py
2019-09-18 12:30:49 +02:00

17 lines
429 B
Python

import gettext
import config
class Texts:
def __init__(self, base: str = 'base'):
self.locale = config.locale
self.texts = gettext.translation(base, localedir='extras/locales',
languages=[self.locale])
self.texts.install()
def __str__(self) -> str:
return self.texts
def get(self, text: str) -> str:
return self.texts.gettext(text)