mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 18:11:54 +08:00
初步的 kvmd 国际化(汉化)支持
1. 添加汉化文件 2. 添加 Lanuages().gettext 函数处理字符替换 3. 修改相关字符串调用
This commit is contained in:
@@ -25,6 +25,8 @@ from typing import AsyncGenerator
|
||||
from ...errors import OperationError
|
||||
from ...errors import IsBusyError
|
||||
|
||||
from ...lanuages import Lanuages
|
||||
|
||||
from .. import BasePlugin
|
||||
from .. import get_plugin_class
|
||||
|
||||
@@ -40,7 +42,7 @@ class AtxOperationError(OperationError, AtxError):
|
||||
|
||||
class AtxIsBusyError(IsBusyError, AtxError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("Performing another ATX operation, please try again later")
|
||||
super().__init__(Lanuages().gettext("Performing another ATX operation, please try again later"))
|
||||
|
||||
|
||||
# =====
|
||||
|
||||
@@ -39,6 +39,8 @@ from ...validators.basic import valid_float_f01
|
||||
from ...validators.os import valid_abs_path
|
||||
from ...validators.hw import valid_gpio_pin
|
||||
|
||||
from ...lanuages import Lanuages
|
||||
|
||||
from . import AtxIsBusyError
|
||||
from . import BaseAtx
|
||||
|
||||
@@ -88,6 +90,7 @@ class Plugin(BaseAtx): # pylint: disable=too-many-instance-attributes
|
||||
notifier=self.__notifier,
|
||||
)
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_plugin_options(cls) -> dict:
|
||||
return {
|
||||
@@ -190,7 +193,7 @@ class Plugin(BaseAtx): # pylint: disable=too-many-instance-attributes
|
||||
await self.__inner_click(name, pin, delay)
|
||||
else:
|
||||
await aiotools.run_region_task(
|
||||
f"Can't perform ATX {name} click or operation was not completed",
|
||||
Lanuages().gettext(f"Can't perform ATX {name} click or operation was not completed"),
|
||||
self.__region, self.__inner_click, name, pin, delay,
|
||||
)
|
||||
|
||||
@@ -203,4 +206,4 @@ class Plugin(BaseAtx): # pylint: disable=too-many-instance-attributes
|
||||
finally:
|
||||
self.__line_request.set_value(pin, gpiod.line.Value(False))
|
||||
await asyncio.sleep(1)
|
||||
get_logger(0).info("Clicked ATX button %r", name)
|
||||
get_logger(0).info(Lanuages().gettext("Clicked ATX button %r"), name)
|
||||
|
||||
Reference in New Issue
Block a user