mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 10:01:53 +08:00
初步的 kvmd 国际化(汉化)支持
1. 添加汉化文件 2. 添加 Lanuages().gettext 函数处理字符替换 3. 修改相关字符串调用
This commit is contained in:
@@ -40,6 +40,7 @@ from ... import aiotools
|
||||
from .. import BasePlugin
|
||||
from .. import get_plugin_class
|
||||
|
||||
from ...lanuages import Lanuages
|
||||
|
||||
# =====
|
||||
class MsdError(Exception):
|
||||
@@ -52,37 +53,44 @@ class MsdOperationError(OperationError, MsdError):
|
||||
|
||||
class MsdIsBusyError(IsBusyError, MsdError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("Performing another MSD operation, please try again later")
|
||||
gettext=Lanuages().gettext
|
||||
super().__init__(gettext("Performing another MSD operation, please try again later"))
|
||||
|
||||
|
||||
class MsdOfflineError(MsdOperationError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("MSD is not found")
|
||||
gettext=Lanuages().gettext
|
||||
super().__init__(gettext("MSD is not found"))
|
||||
|
||||
|
||||
class MsdConnectedError(MsdOperationError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("MSD is connected to Server, but shouldn't for this operation")
|
||||
gettext=Lanuages().gettext
|
||||
super().__init__(gettext("MSD is connected to Server, but shouldn't for this operation"))
|
||||
|
||||
|
||||
class MsdDisconnectedError(MsdOperationError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("MSD is disconnected from Server, but should be for this operation")
|
||||
gettext=Lanuages().gettext
|
||||
super().__init__(gettext("MSD is disconnected from Server, but should be for this operation"))
|
||||
|
||||
|
||||
class MsdImageNotSelected(MsdOperationError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("The image is not selected")
|
||||
gettext=Lanuages().gettext
|
||||
super().__init__(gettext("The image is not selected"))
|
||||
|
||||
|
||||
class MsdUnknownImageError(MsdOperationError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("The image is not found in the storage")
|
||||
gettext=Lanuages().gettext
|
||||
super().__init__(gettext("The image is not found in the storage"))
|
||||
|
||||
|
||||
class MsdImageExistsError(MsdOperationError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("This image is already exists")
|
||||
gettext=Lanuages().gettext
|
||||
super().__init__(gettext("This image is already exists"))
|
||||
|
||||
|
||||
# =====
|
||||
|
||||
Reference in New Issue
Block a user