code style applied to main

This commit is contained in:
pseusys
2023-02-17 15:34:26 +01:00
parent e8a1770feb
commit 8e675eaafd
12 changed files with 442 additions and 473 deletions

View File

@@ -0,0 +1,25 @@
from json import load
from os.path import join, dirname
from typing import Dict
from manager_environment import EnvironmentManager as EM
def init_localization_manager():
"""
"""
LocalizationManager.load_localization("translation.json")
class LocalizationManager:
_LOCALIZATION: Dict[str, str] = dict()
@staticmethod
def load_localization(file: str):
with open(join(dirname(__file__), file), encoding='utf-8') as config_file:
data = load(config_file)
LocalizationManager._LOCALIZATION = data[EM.LOCALE]
@staticmethod
def t(key: str) -> str:
return LocalizationManager._LOCALIZATION[key]