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

@@ -22,7 +22,7 @@
import os
from .lanuages import Lanuages
from .languages import Languages
from . import env
@@ -33,10 +33,10 @@ def find_udc(udc: str) -> str:
candidates = sorted(os.listdir(path))
if not udc:
if len(candidates) == 0:
raise RuntimeError(Lanuages().gettext("Can't find any UDC"))
raise RuntimeError(Languages().gettext("Can't find any UDC"))
udc = candidates[0]
elif udc not in candidates:
raise RuntimeError(Lanuages().gettext(f"Can't find selected UDC: {udc}"))
raise RuntimeError(Languages().gettext(f"Can't find selected UDC: {udc}"))
return udc # fe980000.usb