mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-01 10:31:54 +08:00
初步的 kvmd 国际化(汉化)支持
1. 添加汉化文件 2. 添加 Lanuages().gettext 函数处理字符替换 3. 修改相关字符串调用
This commit is contained in:
@@ -40,6 +40,8 @@ from .... import aiotools
|
||||
from .... import aiomulti
|
||||
from .... import aioproc
|
||||
|
||||
from ....lanuages import Lanuages
|
||||
|
||||
from .. import BaseHid
|
||||
|
||||
from ..otg.events import ResetEvent
|
||||
@@ -107,6 +109,8 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
|
||||
stop_event=self.__stop_event,
|
||||
)
|
||||
|
||||
self.gettext=Lanuages().gettext
|
||||
|
||||
@classmethod
|
||||
def get_plugin_options(cls) -> dict:
|
||||
return {
|
||||
@@ -130,7 +134,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
|
||||
}
|
||||
|
||||
def sysprep(self) -> None:
|
||||
get_logger(0).info("Starting HID daemon ...")
|
||||
get_logger(0).info(self.gettext("Starting HID daemon ..."))
|
||||
self.__proc = multiprocessing.Process(target=self.__server_worker, daemon=True)
|
||||
self.__proc.start()
|
||||
|
||||
@@ -175,7 +179,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
|
||||
async def cleanup(self) -> None:
|
||||
if self.__proc is not None:
|
||||
if self.__proc.is_alive():
|
||||
get_logger(0).info("Stopping HID daemon ...")
|
||||
get_logger(0).info(self.gettext("Stopping HID daemon ..."))
|
||||
self.__stop_event.set()
|
||||
if self.__proc.is_alive() or self.__proc.exitcode is not None:
|
||||
self.__proc.join()
|
||||
@@ -224,5 +228,5 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
|
||||
try:
|
||||
self.__server.run()
|
||||
except Exception:
|
||||
logger.exception("Unexpected HID error")
|
||||
logger.exception(self.gettext("Unexpected HID error"))
|
||||
time.sleep(5)
|
||||
|
||||
Reference in New Issue
Block a user