初步的 kvmd 国际化(汉化)支持

1. 添加汉化文件
2. 添加 Lanuages().gettext 函数处理字符替换
3. 修改相关字符串调用
This commit is contained in:
mofeng-git
2024-08-06 21:45:16 +08:00
parent 6a966af5fb
commit 20927c7226
34 changed files with 999 additions and 113 deletions

View File

@@ -34,6 +34,8 @@ from typing import Generator
from .logging import get_logger
from .lanuages import Lanuages
from . import aiotools
from . import libc
@@ -194,7 +196,7 @@ class Inotify:
for path in paths:
path = os.path.normpath(path)
assert path not in self.__wd_by_path, path
get_logger().info("Watching for %s", path)
get_logger().info(Lanuages().gettext("Watching for %s"), path)
# Асинхронно, чтобы не висло на NFS
wd = _inotify_check(await aiotools.run_async(libc.inotify_add_watch, self.__fd, _fs_encode(path), mask))
self.__wd_by_path[path] = wd
@@ -253,7 +255,7 @@ class Inotify:
if event.mask & InotifyMask.IGNORED:
ignored_path = self.__path_by_wd[event.wd]
if self.__wd_by_path[ignored_path] == event.wd:
logger.info("Unwatching %s because IGNORED was received", ignored_path)
logger.info(Lanuages().gettext("Unwatching %s because IGNORED was received"), ignored_path)
del self.__wd_by_path[ignored_path]
continue