进一步的 kvmd 国际化(汉化)支持

This commit is contained in:
mofeng-git
2024-08-12 22:58:01 +08:00
parent 0af0e2b4d0
commit 5b25b3661f
11 changed files with 599 additions and 90 deletions

View File

@@ -27,6 +27,8 @@ import importlib.machinery
import Xlib.keysymdef
from ..lanuages import Lanuages
from ..logging import get_logger
from .mappings import At1Key
@@ -64,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("Invalid modifier key at mapping %s: %s / %s", src, web_name, key)
logger.error(Lanuages().gettext("Invalid modifier key at mapping %s: %s / %s"), src, web_name, key)
continue
modifiers = (
@@ -117,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("Reading keyboard layout %s ...", path)
logger.info(Lanuages().gettext("Reading keyboard layout %s ..."), path)
with open(path) as file:
lines = list(map(str.strip, file.read().split("\n")))