Created localization_controller.py

This commit is contained in:
sTiKyt 2020-08-13 22:56:08 +03:00
parent 1eb9dd31ba
commit dc0c1baa46
No known key found for this signature in database
GPG Key ID: 510E1C3C9B2414B4

View File

@ -0,0 +1,17 @@
from models.localization_model import LocalizationModel
import gettext
class LocalizationController:
def __init__(self, domain: str = None, localedir: str = None, model=LocalizationModel()):
self._model = model
self._domain = domain if domain is not None else self._model.domain
self._localedir = localedir if localedir is not None else self._model.localedir
def initialize_localization(self):
gettext.bindtextdomain(self._domain, self._localedir)
gettext.textdomain(self._domain)
@staticmethod
def _(text_string):
return gettext.gettext(text_string)