mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-18 00:35:36 +00:00
Debugging..
This commit is contained in:
parent
dc7628ed00
commit
9f65f59896
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hello": "Hello from KuiToi-Server!",
|
||||
"config_file": "Use kuitoi.yml for config.",
|
||||
"config_file": "Use %s for config.",
|
||||
"debug": "Getting new logging with DEBUG level!",
|
||||
"config_info": "Server config: %s",
|
||||
"init": "Initializing ready.",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"hello": "Привет из KuiToi-Server!",
|
||||
"config_file": "Используй kuitoi.yml для настройки.",
|
||||
"config_file": "Используй %s для настройки.",
|
||||
"debug": "Начата новая сессия логирования с уровнем DEBUG!",
|
||||
"config_info": "Конфиг сервера: %s",
|
||||
"init": "Инициализация окончена.",
|
||||
|
@ -9,7 +9,7 @@
|
||||
import builtins
|
||||
import json
|
||||
|
||||
from core import get_logger
|
||||
from core.utils import get_logger
|
||||
|
||||
|
||||
class i18n:
|
||||
@ -25,11 +25,12 @@ class i18n:
|
||||
|
||||
class MultiLanguage:
|
||||
|
||||
def __init__(self, language: str = None, files_dir="modules/i18n/files/"):
|
||||
def __init__(self, language: str = None, files_dir="modules/i18n/files/", encoding="utf-8"):
|
||||
if language is None:
|
||||
language = "en"
|
||||
self.__data = {}
|
||||
self.__i18n = None
|
||||
self.__encoding = encoding
|
||||
self.language = language
|
||||
self.files_dir = files_dir
|
||||
self.log = get_logger("i18n")
|
||||
@ -45,7 +46,7 @@ class MultiLanguage:
|
||||
else:
|
||||
self.__data = {
|
||||
"hello": "Hello from KuiToi-Server!",
|
||||
"config_file": "Use kuitoi.yml for config.",
|
||||
"config_file": "Use %s for config.",
|
||||
"debug": "Getting new logging with DEBUG level!",
|
||||
"config_info": "Server config: %s",
|
||||
"init": "Initializing ready.",
|
||||
@ -57,7 +58,7 @@ class MultiLanguage:
|
||||
self.log.debug("open_file")
|
||||
file = self.files_dir + self.language + ".json"
|
||||
try:
|
||||
with open(file) as f:
|
||||
with open(file, encoding=self.__encoding) as f:
|
||||
self.__data.update(json.load(f))
|
||||
except FileNotFoundError:
|
||||
self.log.warning(f"Localisation {self.language} not found; Setting language to: en.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user