Skip to content

Localization#60

Merged
dereklee0310 merged 3 commits intodereklee0310:mainfrom
zuckerigprod:i18n-new
Feb 17, 2026
Merged

Localization#60
dereklee0310 merged 3 commits intodereklee0310:mainfrom
zuckerigprod:i18n-new

Conversation

@zuckerigprod
Copy link
Contributor

i18n

Uses python-i18n[YAML] for user-facing strings (print, panels, tables, argparse help).
Logger messages are not translated.

YAML was chosen because the project already depends on pyyaml — no extra dependencies for the format itself.

Files

  • en.yml / ru.yml / zh-TW.yml — one flat file per language, +-143 keys each
  • __init__.py — exposes setup(language) and t(key, **kwargs)

Usage

from rf4s.i18n import t

t("bye")                          # "Bye." / "Пока." / "再見。"
t("press_quit", quit="F2")        # "Press F2 to quit."

Language is set from cfg.LANGUAGE (en / ru / zh-TW) in main.py via setup_i18n(cfg.LANGUAGE).
Fallback is always en.


i18n (ru)

Используется python-i18n[YAML] для пользовательского вывода (print, панели, таблицы, argparse help).
Сообщения логгера не переводятся.

YAML выбран потому что проект уже зависит от pyyaml — формат не тянет лишних зависимостей.

Файлы

  • en.yml / ru.yml / zh-TW.yml — один плоский файл на язык, +-143 ключа
  • __init__.py — экспортирует setup(language) и t(key, **kwargs)

Использование

from rf4s.i18n import t

t("bye")                          # "Bye." / "Пока." / "再見。"
t("press_quit", quit="F2")        # "Нажмите F2 для выхода."

Язык берётся из cfg.LANGUAGE (en / ru / zh-TW) в main.py через setup_i18n(cfg.LANGUAGE).
Fallback всегда en.

Copy link
Owner

@dereklee0310 dereklee0310 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the pr, there are a few things that need to be changed.

@dereklee0310
Copy link
Owner

lgtm, could you please do a final check to ensure that everything is working as expected?

@zuckerigprod
Copy link
Contributor Author

lgtm, could you please do a final check to ensure that everything is working as expected?

Yes, I checked everything and corrected the formatting error.

@dereklee0310 dereklee0310 merged commit 7439651 into dereklee0310:main Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants