mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 08:15:42 +00:00
Added Plugins loaders translations.
This commit is contained in:
parent
9295ed2b7a
commit
21dd23cb55
@ -580,13 +580,10 @@ class LuaPluginsLoader:
|
|||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
self.log.debug("Loading Lua plugins...")
|
self.log.debug("Loading Lua plugins...")
|
||||||
# TODO: i18n
|
self.log.info(i18n.plugins_lua_enabled)
|
||||||
self.log.info("You have enabled support for Lua plugins.")
|
self.log.warning(i18n.plugins_lua_nuances_warning)
|
||||||
self.log.warning("There are some nuances to working with KuiToi. "
|
self.log.warning(i18n.plugins_lua_legacy_config_create_warning)
|
||||||
"If you have a proposal for their solution, and it is related to KuiToi, "
|
self.log.info(i18n.plugins_lua_legacy_config_create)
|
||||||
"please contact the developer.")
|
|
||||||
self.log.warning("Some BeamMP plugins require a correctly configured ServerConfig.toml file to function.")
|
|
||||||
self.log.info("Creating it.")
|
|
||||||
data = {
|
data = {
|
||||||
"info": "ServerConfig.toml is created solely for backward compatibility support. "
|
"info": "ServerConfig.toml is created solely for backward compatibility support. "
|
||||||
"This file will be updated every time the program is launched.",
|
"This file will be updated every time the program is launched.",
|
||||||
@ -674,6 +671,6 @@ class LuaPluginsLoader:
|
|||||||
self.log.debug("Unloading lua plugins")
|
self.log.debug("Unloading lua plugins")
|
||||||
for name, data in self.lua_plugins.items():
|
for name, data in self.lua_plugins.items():
|
||||||
if data['ok']:
|
if data['ok']:
|
||||||
self.log.info(f"Unloading lua plugin: {name}")
|
self.log.info(i18n.plugins_lua_unload.format(name))
|
||||||
for _, timer in data['lua'].globals().MP._event_timers.items():
|
for _, timer in data['lua'].globals().MP._event_timers.items():
|
||||||
timer.stop()
|
timer.stop()
|
||||||
|
@ -131,21 +131,21 @@ class PluginsLoader:
|
|||||||
try:
|
try:
|
||||||
is_func = inspect.isfunction
|
is_func = inspect.isfunction
|
||||||
if not is_func(plugin.load):
|
if not is_func(plugin.load):
|
||||||
self.log.error('Function "def load():" not found.')
|
self.log.error(i18n.plugins_not_found_load)
|
||||||
ok = False
|
ok = False
|
||||||
if not is_func(plugin.start):
|
if not is_func(plugin.start):
|
||||||
self.log.error('Function "def start():" not found.')
|
self.log.error(i18n.plugins_not_found_start)
|
||||||
ok = False
|
ok = False
|
||||||
if not is_func(plugin.unload):
|
if not is_func(plugin.unload):
|
||||||
self.log.error('Function "def unload():" not found.')
|
self.log.error(i18n.plugins_not_found_unload)
|
||||||
ok = False
|
ok = False
|
||||||
if type(plugin.kt) != KuiToi:
|
if type(plugin.kt) != KuiToi:
|
||||||
self.log.error(f'Attribute "kt" isn\'t KuiToi class. Plugin file: "{file_path}"')
|
self.log.error(i18n.plugins_kt_invalid)
|
||||||
ok = False
|
ok = False
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
ok = False
|
ok = False
|
||||||
if not ok:
|
if not ok:
|
||||||
self.log.error(f'Plugin file: "{file_path}" is not a valid KuiToi plugin.')
|
self.log.error(i18n.plugins_invalid.format(file_path))
|
||||||
return
|
return
|
||||||
|
|
||||||
pl_name = plugin.kt.name
|
pl_name = plugin.kt.name
|
||||||
@ -185,9 +185,8 @@ class PluginsLoader:
|
|||||||
self.loaded_str += f"{pl_name}:ok, "
|
self.loaded_str += f"{pl_name}:ok, "
|
||||||
self.log.debug(f"Plugin loaded: {file}. Settings: {self.plugins[pl_name]}")
|
self.log.debug(f"Plugin loaded: {file}. Settings: {self.plugins[pl_name]}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# TODO: i18n
|
|
||||||
self.loaded_str += f"{file}:no, "
|
self.loaded_str += f"{file}:no, "
|
||||||
self.log.error(f"Error while loading plugin: {file}; Error: {e}")
|
self.log.error(i18n.plugins_error_loading.format(file, f"{e}"))
|
||||||
self.log.exception(e)
|
self.log.exception(e)
|
||||||
|
|
||||||
async def start(self, _):
|
async def start(self, _):
|
||||||
|
@ -57,6 +57,25 @@
|
|||||||
"client_event_invalid_data": "从事件返回的数据无效:{}",
|
"client_event_invalid_data": "从事件返回的数据无效:{}",
|
||||||
"client_player_disconnected": "离开服务器。游戏时间:{}分钟。",
|
"client_player_disconnected": "离开服务器。游戏时间:{}分钟。",
|
||||||
|
|
||||||
|
"": "Events system",
|
||||||
|
|
||||||
|
"": "插件加载器",
|
||||||
|
|
||||||
|
"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",
|
||||||
"man_message_man": "man - 显示COMMAND的帮助页面。\n用法:man COMMAND",
|
"man_message_man": "man - 显示COMMAND的帮助页面。\n用法:man COMMAND",
|
||||||
"help_message_man": "显示COMMAND的帮助页面。",
|
"help_message_man": "显示COMMAND的帮助页面。",
|
||||||
|
@ -57,6 +57,25 @@
|
|||||||
"client_event_invalid_data": "Invalid data returned from event: {}",
|
"client_event_invalid_data": "Invalid data returned from event: {}",
|
||||||
"client_player_disconnected": "Left the server. Playtime: {} min",
|
"client_player_disconnected": "Left the server. Playtime: {} min",
|
||||||
|
|
||||||
|
"": "Events system",
|
||||||
|
|
||||||
|
"": "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",
|
"": "Command: man",
|
||||||
"man_message_man": "man - Shows the help page for COMMAND.\nUsage: man COMMAND",
|
"man_message_man": "man - Shows the help page for COMMAND.\nUsage: man COMMAND",
|
||||||
"help_message_man": "Shows the help page for COMMAND.",
|
"help_message_man": "Shows the help page for COMMAND.",
|
||||||
|
@ -57,6 +57,25 @@
|
|||||||
"client_event_invalid_data": "Из ивента вернулись не верные данные: {}",
|
"client_event_invalid_data": "Из ивента вернулись не верные данные: {}",
|
||||||
"client_player_disconnected": "Вышел с сервера. Время игры: {} мин",
|
"client_player_disconnected": "Вышел с сервера. Время игры: {} мин",
|
||||||
|
|
||||||
|
"": "Events system",
|
||||||
|
|
||||||
|
"": "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",
|
"": "Command: man",
|
||||||
"man_message_man": "man - Показывает страничку помощи для COMMAND.\nИспользование: man COMMAND",
|
"man_message_man": "man - Показывает страничку помощи для COMMAND.\nИспользование: man COMMAND",
|
||||||
"help_message_man": "Показывает страничку помощи для COMMAND.",
|
"help_message_man": "Показывает страничку помощи для COMMAND.",
|
||||||
|
@ -60,6 +60,27 @@ class i18n:
|
|||||||
client_event_invalid_data: str
|
client_event_invalid_data: str
|
||||||
client_player_disconnected: str
|
client_player_disconnected: str
|
||||||
|
|
||||||
|
# Events system
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Plugins loader
|
||||||
|
|
||||||
|
plugins_not_found_load: str
|
||||||
|
plugins_not_found_start: str
|
||||||
|
plugins_not_found_unload: str
|
||||||
|
plugins_kt_invalid: str
|
||||||
|
plugins_invalid: str
|
||||||
|
plugins_error_loading: str
|
||||||
|
|
||||||
|
# Lua plugins loader
|
||||||
|
|
||||||
|
plugins_lua_enabled: str
|
||||||
|
plugins_lua_nuances_warning: str
|
||||||
|
plugins_lua_legacy_config_create_warning: str
|
||||||
|
plugins_lua_legacy_config_create: str
|
||||||
|
plugins_lua_unload: str
|
||||||
|
|
||||||
# Command: man
|
# Command: man
|
||||||
man_message_man: str
|
man_message_man: str
|
||||||
help_message_man: str
|
help_message_man: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user