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