mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2026-04-08 08:56:27 +00:00
Move translations
This commit is contained in:
@@ -1,107 +0,0 @@
|
||||
{
|
||||
"": "基本阶段",
|
||||
"hello": "来自KuiToi-Server的问候!",
|
||||
"config_path": "使用{}进行配置。",
|
||||
"init_ok": "初始化完成。",
|
||||
"start": "服务器已启动!",
|
||||
"stop": "服务器已停止!",
|
||||
|
||||
"": "服务器认证",
|
||||
"auth_need_key": "需要BeamMP密钥才能运行!",
|
||||
"auth_empty_key": "BeamMP密钥为空!",
|
||||
"auth_cannot_open_browser": "无法打开浏览器:{}",
|
||||
"auth_use_link": "使用此链接:{}",
|
||||
|
||||
"": "GUI阶段",
|
||||
"GUI_yes": "是",
|
||||
"GUI_no": "否",
|
||||
"GUI_ok": "确定",
|
||||
"GUI_cancel": "取消",
|
||||
"GUI_need_key_message": "需要BeamMP密钥才能运行!\n您是否要在浏览器中打开链接获取密钥?",
|
||||
"GUI_enter_key_message": "请输入密钥:",
|
||||
"GUI_cannot_open_browser": "无法打开浏览器。\n请使用此链接:{}",
|
||||
|
||||
"": "Web阶段",
|
||||
"web_start": "WebAPI已启动于{}(按CTRL+C停止)",
|
||||
|
||||
"": "核心短语",
|
||||
"core_bind_failed": "无法绑定端口。错误:{}",
|
||||
"core_direct_mode": "服务器以直接连接模式启动。",
|
||||
"core_auth_server_error": "从BeamMP认证服务器接收到无效响应。",
|
||||
"core_auth_server_refused": "BeamMP认证服务器拒绝了您的密钥。原因:{}",
|
||||
"core_auth_server_refused_no_reason": "BeamMP认证服务器没有提供原因。",
|
||||
"core_auth_server_refused_direct_node": "服务器仍在运行,但以直接连接模式运行。",
|
||||
"core_auth_server_no_response": "无法验证服务器。",
|
||||
"core_mods_loaded": "已加载{}个模组。{}Mb",
|
||||
"core_identifying_connection": "正在处理新连接...",
|
||||
"core_player_kick_outdated": "BeamMP版本不正确。",
|
||||
"core_player_kick_bad_key": "传递的密钥无效!",
|
||||
"core_player_kick_invalid_key": "无效的密钥!请重新启动游戏。",
|
||||
"core_player_kick_auth_server_fail": "BeamMP认证服务器失败!请在5分钟后再次尝试连接。",
|
||||
"core_player_kick_stale": "过时的客户端。(由新连接替换)",
|
||||
"core_player_kick_no_allowed_default_reason": "您不受欢迎。拒绝访问。",
|
||||
"core_player_kick_server_full": "服务器已满。",
|
||||
"core_player_set_id": "玩家设置ID {}",
|
||||
"core_identifying_okay": "成功登录。",
|
||||
|
||||
"": "游戏内短语",
|
||||
"game_welcome_message": "欢迎{}!",
|
||||
|
||||
"": "客户端类短语",
|
||||
"client_mod_request": "请求模组:{}",
|
||||
"client_mod_sent": "已发送模组:大小:{}mb,速度:{}Mb/s({}秒)",
|
||||
"client_mod_sent_limit": "(限制{}Mb/s)",
|
||||
"client_mod_sent_error": "发送模组时出错:{}",
|
||||
"client_sync_time": "同步时间{}秒。",
|
||||
"client_kicked": "因\"{}\"原因被踢出。",
|
||||
"client_event_invalid_data": "从事件返回的数据无效:{}",
|
||||
"client_player_disconnected": "离开服务器。游戏时间:{}分钟。",
|
||||
|
||||
"": "事件系统",
|
||||
|
||||
"events_not_callable": "无法添加事件\"{}\"。请改用\"{}\"。跳过...",
|
||||
"events_not_found": "事件\"{}\"未注册。也许{}?跳过...",
|
||||
"events_calling_error": "调用函数\"{}\"时出错。",
|
||||
"events_lua_function_not_found": "无法调用{}lua事件 - 未找到\"{}\"。",
|
||||
"events_lua_local": "本地 ",
|
||||
"events_lua_calling_error": "错误:\"{}\" - 调用lua事件\"{}\"时出错,函数:\"{}\",参数:{}",
|
||||
|
||||
"": "插件加载器",
|
||||
|
||||
"plugins_not_found_load": "未找到\"def load():\"函数。",
|
||||
"plugins_not_found_start": "未找到\"def start():\"函数。",
|
||||
"plugins_not_found_unload": "未找到\"def unload():\"函数。",
|
||||
"plugins_kt_invalid": "“kt”变量不属于KuiToi类。",
|
||||
"plugins_invalid": "无法在KuiToi中运行插件\"{}\"。",
|
||||
"plugins_error_loading": "加载插件{}时出错:{}",
|
||||
|
||||
"": "Lua插件加载器",
|
||||
|
||||
"plugins_lua_enabled": "您已启用Lua插件支持。",
|
||||
"plugins_lua_nuances_warning": "在使用KuiToi时有一些细微差别。如果您有关于解决方案的建议,并且它与KuiToi相关,请联系开发人员。",
|
||||
"plugins_lua_legacy_config_create_warning": "一些BeamMP插件需要一个正确配置的ServerConfig.toml文件才能正常运行。",
|
||||
"plugins_lua_legacy_config_create": "正在创建。",
|
||||
"plugins_lua_unload": "停止Lua插件:{}",
|
||||
|
||||
"": "命令:man",
|
||||
"man_message_man": "man - 显示COMMAND的帮助页面。\n用法:man COMMAND",
|
||||
"help_message_man": "显示COMMAND的帮助页面。",
|
||||
"man_for": "帮助页面",
|
||||
"man_message_not_found": "man:找不到帮助页面。",
|
||||
"man_command_not_found": "man:找不到命令\"{}\"!",
|
||||
|
||||
"": "命令:help",
|
||||
"man_message_help": "help - 显示命令的名称和简要说明。\n用法:help [--raw]\n`help`命令显示所有可用命令的名称和简要说明。",
|
||||
"help_message_help": "显示命令的名称和简要说明。",
|
||||
"help_command": "命令",
|
||||
"help_message": "文本",
|
||||
"help_message_not_found": "未找到文本。",
|
||||
|
||||
"": "命令:stop",
|
||||
"man_message_stop": "stop - 停止服务器。\n用法:stop",
|
||||
"help_message_stop": "停止服务器。",
|
||||
|
||||
"": "命令:exit",
|
||||
"man_message_exit": "exit - 停止服务器。\n用法:exit",
|
||||
"help_message_exit": "停止服务器。"
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
{
|
||||
"": "Basic phases",
|
||||
"hello": "Hello from KuiToi-Server!",
|
||||
"config_path": "Use {} to configure.",
|
||||
"init_ok": "Initialization completed.",
|
||||
"start": "Server started!",
|
||||
"stop": "Server stopped!",
|
||||
|
||||
"": "Server auth",
|
||||
"auth_need_key": "BeamMP key is required to run!",
|
||||
"auth_empty_key": "BeamMP key is empty!",
|
||||
"auth_cannot_open_browser": "Failed to open browser: {}",
|
||||
"auth_use_link": "Use this link: {}",
|
||||
|
||||
"": "GUI phases",
|
||||
"GUI_yes": "Yes",
|
||||
"GUI_no": "No",
|
||||
"GUI_ok": "OK",
|
||||
"GUI_cancel": "Cancel",
|
||||
"GUI_need_key_message": "BeamMP key is required to run!\nDo you want to open the link in your browser to get the key?",
|
||||
"GUI_enter_key_message": "Please enter the key:",
|
||||
"GUI_cannot_open_browser": "Failed to open browser.\nUse this link: {}",
|
||||
|
||||
"": "Web phases",
|
||||
"web_start": "WebAPI started on {} (CTRL+C to stop)",
|
||||
|
||||
"": "Core phrases",
|
||||
"core_bind_failed": "Failed to bind port. Error: {}",
|
||||
"core_direct_mode": "Server started in direct connection mode.",
|
||||
"core_auth_server_error": "Received invalid response from BeamMP authentication server.",
|
||||
"core_auth_server_refused": "The BeamMP authentication server refused your key. Reason: {}",
|
||||
"core_auth_server_refused_no_reason": "The BeamMP authentication server did not provide a reason.",
|
||||
"core_auth_server_refused_direct_node": "The server is still running, but in direct connection mode.",
|
||||
"core_auth_server_no_response": "Failed to authenticate the server.",
|
||||
"core_mods_loaded": "Loaded {} mods. {}Mb",
|
||||
"core_identifying_connection": "Processing new connection...",
|
||||
"core_player_kick_outdated": "Incorrect version of BeamMP.",
|
||||
"core_player_kick_bad_key": "Invalid key passed!",
|
||||
"core_player_kick_invalid_key": "Invalid key! Please restart your game.",
|
||||
"core_player_kick_auth_server_fail": "BeamMP authentication server failed! Please try to connect again in 5 minutes.",
|
||||
"core_player_kick_stale": "Stale client. (Replaced by new connection)",
|
||||
"core_player_kick_no_allowed_default_reason": "You are not welcome on this server. Access denied.",
|
||||
"core_player_kick_server_full": "Server is full.",
|
||||
"core_player_set_id": "Player set ID {}",
|
||||
"core_identifying_okay": "Successful login.",
|
||||
|
||||
"": "In-game phrases",
|
||||
"game_welcome_message": "Welcome {}!",
|
||||
|
||||
"": "Client class phrases",
|
||||
"client_mod_request": "Requested mod: {}",
|
||||
"client_mod_sent": "Mod sent: Size: {}mb, Speed: {}Mb/s ({}sec)",
|
||||
"client_mod_sent_limit": " (limit {}Mb/s)",
|
||||
"client_mod_sent_error": "Error sending mod: {}",
|
||||
"client_sync_time": "Sync time {}sec.",
|
||||
"client_kicked": "Kicked for reason: \"{}\"",
|
||||
"client_event_invalid_data": "Invalid data returned from event: {}",
|
||||
"client_player_disconnected": "Left the server. Playtime: {} min",
|
||||
|
||||
"": "Events system",
|
||||
|
||||
"events_not_callable": "Unable to add event \"{}\". Use \"{}\" instead. Skipping...",
|
||||
"events_not_found": "Event \"{}\" is not registered. Maybe {}? Skipping...",
|
||||
"events_calling_error": "Error calling \"{}\" in function \"{}\".",
|
||||
"events_lua_function_not_found": "Unable to call {}lua event - \"{}\" not found.",
|
||||
"events_lua_local": "local ",
|
||||
"events_lua_calling_error": "Error: \"{}\" - calling lua event \"{}\", function: \"{}\", arguments: {}",
|
||||
|
||||
"": "Plugins loader",
|
||||
|
||||
"plugins_not_found_load": "Function \"def load():\" not found.",
|
||||
"plugins_not_found_start": "Function \"def start():\" not found.",
|
||||
"plugins_not_found_unload": "Function \"def unload():\" not found.",
|
||||
"plugins_kt_invalid": "\"kt\" variable does not belong to the KuiToi class.",
|
||||
"plugins_invalid": "Plugin \"{}\" cannot be run in KuiToi.",
|
||||
"plugins_error_loading": "An error occurred while loading the plugin {}: {}",
|
||||
|
||||
"": "Lua plugins loader",
|
||||
|
||||
"plugins_lua_enabled": "You have enabled Lua plugin support.",
|
||||
"plugins_lua_nuances_warning": "There are some nuances when working with Kuiti. If you have a suggestion for their solution, and it is related to KuiToi, please contact the developer.",
|
||||
"plugins_lua_legacy_config_create_warning": "Some BeamMP plugins require a properly configured ServerConfig.toml file to function.",
|
||||
"plugins_lua_legacy_config_create": "Creating it.",
|
||||
"plugins_lua_unload": "Stopping Lua plugin: {}",
|
||||
|
||||
"": "Command: man",
|
||||
"man_message_man": "man - Shows the help page for COMMAND.\nUsage: man COMMAND",
|
||||
"help_message_man": "Shows the help page for COMMAND.",
|
||||
"man_for": "Help page for",
|
||||
"man_message_not_found": "man: Help page not found.",
|
||||
"man_command_not_found": "man: Command \"{}\" not found!",
|
||||
|
||||
"": "Command: help",
|
||||
"man_message_help": "help - Shows the names and brief descriptions of commands.\nUsage: help [--raw]\nThe `help` command displays a list of all available commands, with a brief description for each command.",
|
||||
"help_message_help": "Shows the names and brief descriptions of commands",
|
||||
"help_command": "Command",
|
||||
"help_message": "Text",
|
||||
"help_message_not_found": "No text found",
|
||||
|
||||
"": "Command: stop",
|
||||
"man_message_stop": "stop - Stops the server.\nUsage: stop",
|
||||
"help_message_stop": "Stops the server.",
|
||||
|
||||
"": "Command: exit",
|
||||
"man_message_exit": "exit - Stops the server.\nUsage: exit",
|
||||
"help_message_exit": "Stops the server."
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
{
|
||||
"": "Basic phases",
|
||||
"hello": "Привет из KuiToi-Server!",
|
||||
"config_path": "Используй {} для настройки.",
|
||||
"init_ok": "Инициализация окончена.",
|
||||
"start": "Сервер запущен!",
|
||||
"stop": "Сервер остановлен!",
|
||||
|
||||
"": "Server auth",
|
||||
"auth_need_key": "Нужен BeamMP ключ для запуска!",
|
||||
"auth_empty_key": "BeamMP ключ пустой!",
|
||||
"auth_cannot_open_browser": "Не получилось открыть браузер: {}",
|
||||
"auth_use_link": "Используй эту ссылку: {}",
|
||||
|
||||
"": "GUI phases",
|
||||
"GUI_yes": "Да",
|
||||
"GUI_no": "Нет",
|
||||
"GUI_ok": "Окей",
|
||||
"GUI_cancel": "Отмена",
|
||||
"GUI_need_key_message": "Нужен BeamMP ключ для запуска!\nХотите открыть ссылку в браузере для получения ключа?",
|
||||
"GUI_enter_key_message": "Пожалуйста введите ключ:",
|
||||
"GUI_cannot_open_browser": "Не получилось открыть браузер.\nИспользуй эту ссылку: {}",
|
||||
|
||||
"": "Web phases",
|
||||
"web_start": "WebAPI запустился на {} (CTRL+C для выключения)",
|
||||
|
||||
"": "Core phrases",
|
||||
"core_bind_failed": "Не получилось занять порт. Ошибка: {}",
|
||||
"core_direct_mode": "Сервер запушен в режиме прямого подключения.",
|
||||
"core_auth_server_error": "Поступил не корректный ответ от сервером авторизации BeamMP.",
|
||||
"core_auth_server_refused": "Сервер авторизации BeamMP отклонил ваш ключ. Причина: {}",
|
||||
"core_auth_server_refused_no_reason": "Сервер авторизации BeamMP не сообщил причины.",
|
||||
"core_auth_server_refused_direct_node": "Сервер всё ещё работает, но в режиме прямого подключения.",
|
||||
"core_auth_server_no_response": "Не получилось авторизовать сервер.",
|
||||
"core_mods_loaded": "Загружено {} модов. {}Мб",
|
||||
"core_identifying_connection": "Обработка нового подключения...",
|
||||
"core_player_kick_outdated": "Не подходящая версия BeamMP.",
|
||||
"core_player_kick_bad_key": "Передан не правильный ключ!",
|
||||
"core_player_kick_invalid_key": "Неверный ключ! Пожалуйста, перезапустите свою игру.",
|
||||
"core_player_kick_auth_server_fail": "Сбой сервера аутентификации! Попробуйте снова подключиться через 5 минут.",
|
||||
"core_player_kick_stale": "Устаревший клиент. (Заменено новым подключением)",
|
||||
"core_player_kick_no_allowed_default_reason": "Вам не рады на этом сервере. Вход запрещён.",
|
||||
"core_player_kick_server_full": "Сервер полон.",
|
||||
"core_player_set_id": "Игрок получил ID {}",
|
||||
"core_identifying_okay": "Успешный вход.",
|
||||
|
||||
"": "In-game phrases",
|
||||
"game_welcome_message": "Добро пожаловать {}!",
|
||||
|
||||
"": "Client class phrases",
|
||||
"client_mod_request": "Запрошен мод: {}",
|
||||
"client_mod_sent": "Мод отправлен: Вес: {}мб, Скорость: {}Мб/с ({}сек)",
|
||||
"client_mod_sent_limit": " (лимит {}Мб/с)",
|
||||
"client_mod_sent_error": "Ошибка при отправке мода: {}",
|
||||
"client_sync_time": "Время синхронизации {}сек.",
|
||||
"client_kicked": "Кикнут по причине: \"{}\"",
|
||||
"client_event_invalid_data": "Из ивента вернулись не верные данные: {}",
|
||||
"client_player_disconnected": "Вышел с сервера. Время игры: {} мин",
|
||||
|
||||
"": "Events system",
|
||||
|
||||
"events_not_callable": "Невозможно добавить ивент \"{}\". Использую лучше \"{}\". Скип...",
|
||||
"events_not_found": "Ивент \"{}\" не зарегистрирован. Может {}? Скип...",
|
||||
"events_calling_error": "Ошибка во время вызова \"{}\" в функции \"{}\".",
|
||||
"events_lua_function_not_found": "Невозможно вызвать {}lua ивент - \"{}\" не найдена.",
|
||||
"events_lua_local": "локальный ",
|
||||
"events_lua_calling_error": "Ошибка: \"{}\" - во время вызова lua ивента \"{}\", функция: \"{}\" , аргументы: {}",
|
||||
|
||||
"": "Plugins loader",
|
||||
|
||||
"plugins_not_found_load": "Функция \"def load():\" не найдена.",
|
||||
"plugins_not_found_start": "Функция \"def start():\" не найдена.",
|
||||
"plugins_not_found_unload": "Функция \"def unload():\" не найдена.",
|
||||
"plugins_kt_invalid": "Переменная \"kt\" не принадлежит классу KuiToi.",
|
||||
"plugins_invalid": "Плагин: \"{}\" - не может быть запущен в KuiToi.",
|
||||
"plugins_error_loading": "Произошла ошибка при загрузке плагина {}: {}",
|
||||
|
||||
"": "Lua plugins loader",
|
||||
|
||||
"plugins_lua_enabled": "Вы включили поддержку плагинов Lua.",
|
||||
"plugins_lua_nuances_warning": "В работе с Kuiti есть некоторые нюансы. Если у вас есть предложение по их решению, и оно связано с KuiToi, пожалуйста, свяжитесь с разработчиком.",
|
||||
"plugins_lua_legacy_config_create_warning": "Для работы некоторых плагинов BeamMP требуется правильно настроенный файл ServerConfig.toml.",
|
||||
"plugins_lua_legacy_config_create": "Создаю его.",
|
||||
"plugins_lua_unload": "Останавливаю Lua плагин: {}",
|
||||
|
||||
"": "Command: man",
|
||||
"man_message_man": "man - Показывает страничку помощи для COMMAND.\nИспользование: man COMMAND",
|
||||
"help_message_man": "Показывает страничку помощи для COMMAND.",
|
||||
"man_for": "Страничка помощи для",
|
||||
"man_message_not_found": "man: Страничка помощи не найдена.",
|
||||
"man_command_not_found": "man: Команда \"{}\" не найдена!",
|
||||
|
||||
"": "Command: help",
|
||||
"man_message_help": "help - Показывает названия и краткое описание команд.\nИспользование: help [--raw]\nКоманда `help` выводит список всех доступных команд, и краткое описание для каждой команды.",
|
||||
"help_message_help": "Показывает названия и краткое описание команд",
|
||||
"help_command": "Команда",
|
||||
"help_message": "Текст",
|
||||
"help_message_not_found": "Нет текста",
|
||||
|
||||
"": "Command: stop",
|
||||
"man_message_stop": "stop - Выключает сервер.\nИспользование: stop",
|
||||
"help_message_stop": "Выключает сервер.",
|
||||
|
||||
"": "Command: exit",
|
||||
"man_message_exit": "exit - Выключает сервер.\nИспользование: exit",
|
||||
"help_message_exit": "Выключает сервер."
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
# (c) kuitoi.su 2023
|
||||
import builtins
|
||||
import json
|
||||
import os
|
||||
from json import JSONDecodeError
|
||||
|
||||
from core.utils import get_logger
|
||||
@@ -25,135 +26,110 @@ class i18n:
|
||||
|
||||
class MultiLanguage:
|
||||
|
||||
def __init__(self, language: str = None, files_dir="modules/i18n/files/", encoding=None):
|
||||
def __init__(self, language: str = None, files_dir="translates/", encoding=None):
|
||||
if encoding is None:
|
||||
encoding = config.enc
|
||||
if language is None:
|
||||
language = "en"
|
||||
self.__data = {}
|
||||
self.__data = {
|
||||
"hello": "Hello from KuiToi-Server!",
|
||||
"config_path": "Use {} to configure.",
|
||||
"init_ok": "Initialization completed.",
|
||||
"start": "Server started!",
|
||||
"stop": "Server stopped!",
|
||||
"auth_need_key": "BeamMP key is required to run!",
|
||||
"auth_empty_key": "BeamMP key is empty!",
|
||||
"auth_cannot_open_browser": "Failed to open browser: {}",
|
||||
"auth_use_link": "Use this link: {}",
|
||||
"GUI_yes": "Yes",
|
||||
"GUI_no": "No",
|
||||
"GUI_ok": "OK",
|
||||
"GUI_cancel": "Cancel",
|
||||
"GUI_need_key_message": "BeamMP key is required to run!\nDo you want to open the link in your browser to get the key?",
|
||||
"GUI_enter_key_message": "Please enter the key:",
|
||||
"GUI_cannot_open_browser": "Failed to open browser.\nUse this link: {}",
|
||||
"web_start": "WebAPI started on {} (CTRL+C to stop)",
|
||||
"core_bind_failed": "Failed to bind port. Error: {}",
|
||||
"core_direct_mode": "Server started in direct connection mode.",
|
||||
"core_auth_server_error": "Received invalid response from BeamMP authentication server.",
|
||||
"core_auth_server_refused": "The BeamMP authentication server refused your key. Reason: {}",
|
||||
"core_auth_server_refused_no_reason": "The BeamMP authentication server did not provide a reason.",
|
||||
"core_auth_server_refused_direct_node": "The server is still running, but in direct connection mode.",
|
||||
"core_auth_server_no_response": "Failed to authenticate the server.",
|
||||
"core_mods_loaded": "Loaded {} mods. {}Mb",
|
||||
"core_identifying_connection": "Processing new connection...",
|
||||
"core_player_kick_outdated": "Incorrect version of BeamMP.",
|
||||
"core_player_kick_bad_key": "Invalid key passed!",
|
||||
"core_player_kick_invalid_key": "Invalid key! Please restart your game.",
|
||||
"core_player_kick_auth_server_fail": "BeamMP authentication server failed! Please try to connect again in 5 minutes.",
|
||||
"core_player_kick_stale": "Stale client. (Replaced by new connection)",
|
||||
"core_player_kick_no_allowed_default_reason": "You are not welcome on this server. Access denied.",
|
||||
"core_player_kick_server_full": "Server is full.",
|
||||
"core_player_set_id": "Player set ID {}",
|
||||
"core_identifying_okay": "Successful login.",
|
||||
"game_welcome_message": "Welcome {}!",
|
||||
"client_mod_request": "Requested mod: {}",
|
||||
"client_mod_sent": "Mod sent: Size: {}mb, Speed: {}Mb/s ({}sec)",
|
||||
"client_mod_sent_limit": " (limit {}Mb/s)",
|
||||
"client_mod_sent_error": "Error sending mod: {}",
|
||||
"client_sync_time": "Sync time {}sec.",
|
||||
"client_kicked": "Kicked for reason: \"{}\"",
|
||||
"client_event_invalid_data": "Invalid data returned from event: {}",
|
||||
"client_player_disconnected": "Left the server. Playtime: {} min",
|
||||
"events_not_callable": "Unable to add event \"{}\". Use \"{}\" instead. Skipping...",
|
||||
"events_not_found": "Event \"{}\" is not registered. Maybe {}? Skipping...",
|
||||
"events_calling_error": "Error calling \"{}\" in function \"{}\".",
|
||||
"events_lua_function_not_found": "Unable to call {}lua event - \"{}\" not found.",
|
||||
"events_lua_local": "local ",
|
||||
"events_lua_calling_error": "Error: \"{}\" - calling lua event \"{}\", function: \"{}\", arguments: {}",
|
||||
"plugins_not_found_load": "Function \"def load():\" not found.",
|
||||
"plugins_not_found_start": "Function \"def start():\" not found.",
|
||||
"plugins_not_found_unload": "Function \"def unload():\" not found.",
|
||||
"plugins_kt_invalid": "\"kt\" variable does not belong to the KuiToi class.",
|
||||
"plugins_invalid": "Plugin \"{}\" cannot be run in KuiToi.",
|
||||
"plugins_error_loading": "An error occurred while loading the plugin {}: {}",
|
||||
"plugins_lua_enabled": "You have enabled Lua plugin support.",
|
||||
"plugins_lua_nuances_warning": "There are some nuances when working with Kuiti. If you have a suggestion for their solution, and it is related to KuiToi, please contact the developer.",
|
||||
"plugins_lua_legacy_config_create_warning": "Some BeamMP plugins require a properly configured ServerConfig.toml file to function.",
|
||||
"plugins_lua_legacy_config_create": "Creating it.",
|
||||
"plugins_lua_unload": "Stopping Lua plugin: {}",
|
||||
"man_message_man": "man - Shows the help page for COMMAND.\nUsage: man COMMAND",
|
||||
"help_message_man": "Shows the help page for COMMAND.",
|
||||
"man_for": "Help page for",
|
||||
"man_message_not_found": "man: Help page not found.",
|
||||
"man_command_not_found": "man: Command \"{}\" not found!",
|
||||
"man_message_help": "help - Shows the names and brief descriptions of commands.\nUsage: help [--raw]\nThe `help` command displays a list of all available commands, with a brief description for each command.",
|
||||
"help_message_help": "Shows the names and brief descriptions of commands",
|
||||
"help_command": "Command",
|
||||
"help_message": "Text",
|
||||
"help_message_not_found": "No text found",
|
||||
"man_message_stop": "stop - Stops the server.\nUsage: stop",
|
||||
"help_message_stop": "Stops the server.",
|
||||
"man_message_exit": "exit - Stops the server.\nUsage: exit",
|
||||
"help_message_exit": "Stops the server."
|
||||
}
|
||||
self.__en_data = self.__data.copy()
|
||||
self.__i18n = None
|
||||
self.__encoding = encoding
|
||||
self.language = language
|
||||
if not os.path.exists(files_dir):
|
||||
os.makedirs(files_dir)
|
||||
if not os.path.exists(files_dir + "en.json"):
|
||||
with open(files_dir + "en.json", "w") as f:
|
||||
f.write(json.dumps(self.__en_data, indent=2))
|
||||
self.files_dir = files_dir
|
||||
self.log = get_logger("i18n")
|
||||
self.fi = False
|
||||
self.set_language(language)
|
||||
|
||||
def set_language(self, language):
|
||||
if language is None:
|
||||
language = "en"
|
||||
self.log.debug(f"set_language({language})")
|
||||
self.language = language
|
||||
if language != "en":
|
||||
self.open_file()
|
||||
def set_language(self, language="en"):
|
||||
if self.language == language and self.fi:
|
||||
return
|
||||
else:
|
||||
# noinspection PyDictDuplicateKeys
|
||||
self.__data = {
|
||||
"": "Basic phases",
|
||||
"hello": "Hello from KuiToi-Server!",
|
||||
"config_path": "Use {} to configure.",
|
||||
"init_ok": "Initialization completed.",
|
||||
"start": "Server started!",
|
||||
"stop": "Server stopped!",
|
||||
|
||||
"": "Server auth",
|
||||
"auth_need_key": "BeamMP key is required to run!",
|
||||
"auth_empty_key": "BeamMP key is empty!",
|
||||
"auth_cannot_open_browser": "Failed to open browser: {}",
|
||||
"auth_use_link": "Use this link: {}",
|
||||
|
||||
"": "GUI phases",
|
||||
"GUI_yes": "Yes",
|
||||
"GUI_no": "No",
|
||||
"GUI_ok": "OK",
|
||||
"GUI_cancel": "Cancel",
|
||||
"GUI_need_key_message": "BeamMP key is required to run!\nDo you want to open the link in your browser to get the key?",
|
||||
"GUI_enter_key_message": "Please enter the key:",
|
||||
"GUI_cannot_open_browser": "Failed to open browser.\nUse this link: {}",
|
||||
|
||||
"": "Web phases",
|
||||
"web_start": "WebAPI started on {} (CTRL+C to stop)",
|
||||
|
||||
"": "Core phrases",
|
||||
"core_bind_failed": "Failed to bind port. Error: {}",
|
||||
"core_direct_mode": "Server started in direct connection mode.",
|
||||
"core_auth_server_error": "Received invalid response from BeamMP authentication server.",
|
||||
"core_auth_server_refused": "The BeamMP authentication server refused your key. Reason: {}",
|
||||
"core_auth_server_refused_no_reason": "The BeamMP authentication server did not provide a reason.",
|
||||
"core_auth_server_refused_direct_node": "The server is still running, but in direct connection mode.",
|
||||
"core_auth_server_no_response": "Failed to authenticate the server.",
|
||||
"core_mods_loaded": "Loaded {} mods. {}Mb",
|
||||
"core_identifying_connection": "Processing new connection...",
|
||||
"core_player_kick_outdated": "Incorrect version of BeamMP.",
|
||||
"core_player_kick_bad_key": "Invalid key passed!",
|
||||
"core_player_kick_invalid_key": "Invalid key! Please restart your game.",
|
||||
"core_player_kick_auth_server_fail": "BeamMP authentication server failed! Please try to connect again in 5 minutes.",
|
||||
"core_player_kick_stale": "Stale client. (Replaced by new connection)",
|
||||
"core_player_kick_no_allowed_default_reason": "You are not welcome on this server. Access denied.",
|
||||
"core_player_kick_server_full": "Server is full.",
|
||||
"core_player_set_id": "Player set ID {}",
|
||||
"core_identifying_okay": "Successful login.",
|
||||
|
||||
"": "In-game phrases",
|
||||
"game_welcome_message": "Welcome {}!",
|
||||
|
||||
"": "Client class phrases",
|
||||
"client_mod_request": "Requested mod: {}",
|
||||
"client_mod_sent": "Mod sent: Size: {}mb, Speed: {}Mb/s ({}sec)",
|
||||
"client_mod_sent_limit": " (limit {}Mb/s)",
|
||||
"client_mod_sent_error": "Error sending mod: {}",
|
||||
"client_sync_time": "Sync time {}sec.",
|
||||
"client_kicked": "Kicked for reason: \"{}\"",
|
||||
"client_event_invalid_data": "Invalid data returned from event: {}",
|
||||
"client_player_disconnected": "Left the server. Playtime: {} min",
|
||||
|
||||
"": "Events system",
|
||||
|
||||
"events_not_callable": "Unable to add event \"{}\". Use \"{}\" instead. Skipping...",
|
||||
"events_not_found": "Event \"{}\" is not registered. Maybe {}? Skipping...",
|
||||
"events_calling_error": "Error calling \"{}\" in function \"{}\".",
|
||||
"events_lua_function_not_found": "Unable to call {}lua event - \"{}\" not found.",
|
||||
"events_lua_local": "local ",
|
||||
"events_lua_calling_error": "Error: \"{}\" - calling lua event \"{}\", function: \"{}\", arguments: {}",
|
||||
|
||||
"": "Plugins loader",
|
||||
|
||||
"plugins_not_found_load": "Function \"def load():\" not found.",
|
||||
"plugins_not_found_start": "Function \"def start():\" not found.",
|
||||
"plugins_not_found_unload": "Function \"def unload():\" not found.",
|
||||
"plugins_kt_invalid": "\"kt\" variable does not belong to the KuiToi class.",
|
||||
"plugins_invalid": "Plugin \"{}\" cannot be run in KuiToi.",
|
||||
"plugins_error_loading": "An error occurred while loading the plugin {}: {}",
|
||||
|
||||
"": "Lua plugins loader",
|
||||
|
||||
"plugins_lua_enabled": "You have enabled Lua plugin support.",
|
||||
"plugins_lua_nuances_warning": "There are some nuances when working with Kuiti. If you have a suggestion for their solution, and it is related to KuiToi, please contact the developer.",
|
||||
"plugins_lua_legacy_config_create_warning": "Some BeamMP plugins require a properly configured ServerConfig.toml file to function.",
|
||||
"plugins_lua_legacy_config_create": "Creating it.",
|
||||
"plugins_lua_unload": "Stopping Lua plugin: {}",
|
||||
|
||||
"": "Command: man",
|
||||
"man_message_man": "man - Shows the help page for COMMAND.\nUsage: man COMMAND",
|
||||
"help_message_man": "Shows the help page for COMMAND.",
|
||||
"man_for": "Help page for",
|
||||
"man_message_not_found": "man: Help page not found.",
|
||||
"man_command_not_found": "man: Command \"{}\" not found!",
|
||||
|
||||
"": "Command: help",
|
||||
"man_message_help": "help - Shows the names and brief descriptions of commands.\nUsage: help [--raw]\nThe `help` command displays a list of all available commands, with a brief description for each command.",
|
||||
"help_message_help": "Shows the names and brief descriptions of commands",
|
||||
"help_command": "Command",
|
||||
"help_message": "Text",
|
||||
"help_message_not_found": "No text found",
|
||||
|
||||
"": "Command: stop",
|
||||
"man_message_stop": "stop - Stops the server.\nUsage: stop",
|
||||
"help_message_stop": "Stops the server.",
|
||||
|
||||
"": "Command: exit",
|
||||
"man_message_exit": "exit - Stops the server.\nUsage: exit",
|
||||
"help_message_exit": "Stops the server."
|
||||
}
|
||||
self.fi = True
|
||||
self.log.debug(f"set_language({language})")
|
||||
self.language = language
|
||||
self.open_file()
|
||||
self.__i18n = i18n(self.__data)
|
||||
|
||||
def open_file(self):
|
||||
@@ -165,9 +141,9 @@ class MultiLanguage:
|
||||
return
|
||||
except JSONDecodeError:
|
||||
self.log.error(
|
||||
f"Localisation \"{self.language}.json\" have JsonDecodeError. Using default localisation: en.")
|
||||
f"Localisation \"{file}\" have JsonDecodeError. Using default localisation: en.")
|
||||
except FileNotFoundError:
|
||||
self.log.warning(f"Localisation \"{self.language}.json\" not found; Using default localisation: en.")
|
||||
self.log.warning(f"Localisation \"{file}\" not found; Using default localisation: en.")
|
||||
self.set_language("en")
|
||||
|
||||
def builtins_hook(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user