进一步的 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

@@ -34,7 +34,7 @@ from typing import Generator
from .logging import get_logger
from .lanuages import Lanuages
from .languages import Languages
from . import aiotools
from . import libc
@@ -196,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(Lanuages().gettext("Watching for %s"), path)
get_logger().info(Languages().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
@@ -255,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(Lanuages().gettext("Unwatching %s because IGNORED was received"), ignored_path)
logger.info(Languages().gettext("Unwatching %s because IGNORED was received"), ignored_path)
del self.__wd_by_path[ignored_path]
continue