Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/PiFinder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ def main(
rlogger.warning("using no keyboard")

if args.lang:
if args.lang.lower() not in ["en", "de", "fr", "es"]:
if args.lang.lower() not in ["en", "de", "fr", "es", "ko", "zh"]:
raise Exception(f"Unknown language '{args.lang}' passed via command line.")
else:
config.Config().set_option("language", args.lang)
Expand Down
4 changes: 2 additions & 2 deletions python/PiFinder/ui/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ def switch_language(ui_module: UIModule) -> None:
)
lang.install()
logger.info("Switch Language: %s", iso2_code)
if iso2_code == "zh":
# Chinese requires a new font, so we have to restart
if iso2_code in ["ko", "zh"]:
# CJK languages require a different font, so we have to restart.
restart_pifinder(ui_module)


Expand Down
11 changes: 5 additions & 6 deletions python/PiFinder/ui/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ def __init__(
):
font_path = str(Path(utils.pifinder_dir, "fonts"))

# Check for chinese language specifically
# CJK languages need a font with the required glyph coverage.
cfg = config.Config()
lang = cfg.get_option("language", "en")
if lang == "zh":
# Use Chinese font for Chinese language
chinesettf = str(
if lang in ["ko", "zh"]:
cjk_ttf = str(
Path(font_path, "sarasa-mono-sc-light-nerd-font+patched.ttf")
)
boldttf = chinesettf
regularttf = chinesettf
boldttf = cjk_ttf
regularttf = cjk_ttf
use_layout_engine = False
else:
# Use default fonts for other languages
Expand Down
5 changes: 5 additions & 0 deletions python/PiFinder/ui/menu_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def _(key: str) -> Any:
s = _("Language: en")
s = _("Language: es")
s = _("Language: fr")
s = _("Language: ko")
s = _("Language: zh")
s = s
del s
Expand Down Expand Up @@ -799,6 +800,10 @@ def _(key: str) -> Any:
"name": _("Chinese"),
"value": "zh",
},
{
"name": _("Korean"),
"value": "ko",
},
],
},
],
Expand Down
Binary file added python/locale/ko/LC_MESSAGES/messages.mo
Binary file not shown.
Loading
Loading