进一步的 kvmd 国际化(汉化)支持,添加配置入口

yaml 配置示例:
```
languages:
    console: zh
    web: zh
```
This commit is contained in:
mofeng-git
2024-08-14 22:54:12 +08:00
parent 5b25b3661f
commit 35397c5414
47 changed files with 567 additions and 181 deletions

View File

@@ -27,7 +27,7 @@ import importlib.machinery
import Xlib.keysymdef
from ..lanuages import Lanuages
from ..languages import Languages
from ..logging import get_logger
@@ -66,7 +66,7 @@ def build_symmap(path: str) -> dict[int, dict[int, str]]: # x11 keysym -> [(mod
or (web_name in WebModifiers.ALTS and key.altgr)
or (web_name in WebModifiers.CTRLS and key.ctrl)
):
logger.error(Lanuages().gettext("Invalid modifier key at mapping %s: %s / %s"), src, web_name, key)
logger.error(Languages().gettext("Invalid modifier key at mapping %s: %s / %s"), src, web_name, key)
continue
modifiers = (
@@ -119,7 +119,7 @@ def _resolve_keysym(name: str) -> int:
def _read_keyboard_layout(path: str) -> dict[int, list[At1Key]]: # Keysym to evdev (at1)
logger = get_logger(0)
logger.info(Lanuages().gettext("Reading keyboard layout %s ..."), path)
logger.info(Languages().gettext("Reading keyboard layout %s ..."), path)
with open(path) as file:
lines = list(map(str.strip, file.read().split("\n")))