Skip to content

feat: add English localization and Russian README translation#78

Merged
Egor051 merged 4 commits into
mainfrom
claude/add-english-localization-SumoY
May 21, 2026
Merged

feat: add English localization and Russian README translation#78
Egor051 merged 4 commits into
mainfrom
claude/add-english-localization-SumoY

Conversation

@Egor051
Copy link
Copy Markdown
Owner

@Egor051 Egor051 commented May 21, 2026

Summary

  • Introduces a flat-dict i18n system (i18n/ package) with Russian (ru.py) and English (en.py) locale files (~200 strings each). The active locale is selected via the BOT_LANGUAGE env var (default: ru).
  • config/settings.py: new bot_language field, validated to {ru, en}.
  • main.py: i18n.configure() is called before any handler modules are imported, so F.text == t("...") decorators in aiogram filters resolve with the correct locale at import time.
  • bot/formatters.py: all user-facing strings replaced with t() calls; module-level Russian constants removed.
  • bot/private_chat.py: removed PRIVATE_ONLY_TEXT constant, uses t() inline.
  • bot/keyboards/common.py, admin.py, keys.py, proxy.py: all button labels replaced with t() calls.
  • bot/handlers/common.py, start.py, admin.py, keys.py, proxy.py, callbacks.py: all hardcoded Russian strings replaced with t() calls; stale constant imports removed.
  • README_RU.md: full, accurate Russian translation of README.md.

Test plan

  • Run bot with BOT_LANGUAGE=ru — all messages and button labels appear in Russian (existing behaviour unchanged)
  • Run bot with BOT_LANGUAGE=en — all messages and button labels appear in English
  • Confirm F.text menu filters (btn_my_keys, btn_create_key, btn_proxy, btn_help, btn_admin_panel) route correctly in both locales
  • Exercise key creation, proxy request, FAQ, admin panel, and announcement flows end-to-end in both locales
  • Verify BOT_LANGUAGE=fr (invalid) is rejected at startup

https://claude.ai/code/session_01ARDGi134VgnEyo1FPCeaNd


Generated by Claude Code

Introduce a flat-dict i18n system (i18n/__init__.py) with Russian
(i18n/ru.py) and English (i18n/en.py) locale files.  The active locale
is selected via the BOT_LANGUAGE env var (default: ru).

- config/settings.py: new bot_language field, validated to {ru, en}
- main.py: call i18n.configure() before importing handler modules so
  F.text == t("...") decorators resolve with the correct locale
- bot/formatters.py: all user-facing strings replaced with t() calls,
  module-level Russian constants removed
- bot/private_chat.py: removed PRIVATE_ONLY_TEXT constant, use t() inline
- bot/keyboards/common.py, admin.py, keys.py, proxy.py: all button
  labels replaced with t() calls
- bot/handlers/common.py, start.py, admin.py, keys.py, proxy.py,
  callbacks.py: all hardcoded Russian strings replaced with t() calls;
  stale constant imports removed
- README_RU.md: full accurate Russian translation of README.md

https://claude.ai/code/session_01ARDGi134VgnEyo1FPCeaNd
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

claude added 3 commits May 21, 2026 12:43
- test_followup_hardening: replace removed ADMIN_PRIVATE_ONLY_TEXT
  constant import with i18n.configure("ru") + t() call
- i18n/ru.py: change btn_next from Дальше to Далее (matching original
  hardcoded label); add proxy_socks5_traffic_note key with Russian text
- i18n/en.py: add proxy_socks5_traffic_note key with English text
- bot/formatters.py: use t("proxy_socks5_traffic_note") instead of
  hardcoded English in proxy_admin_status_text

Fixes CI test failures introduced by the i18n refactor.

https://claude.ai/code/session_01ARDGi134VgnEyo1FPCeaNd
Use distinct local names (_en, _ru) for conditional imports instead of
reusing _mod in both branches, which mypy flagged as a re-definition.

https://claude.ai/code/session_01ARDGi134VgnEyo1FPCeaNd
…ions

Fix translation errors from the literal first pass:
- "hardening tests" was wrongly translated as "нагрузочные тесты" (load
  tests); now kept as "hardening-тесты"
- "non-secret reason" was wrongly rendered as "непривилегированной
  причиной"; now "без раскрытия секретных деталей"
- "committed transactions" (SQLite) was confused with git commits; now
  "зафиксированных транзакций"

Apply the main rule: keep English terms when the Russian equivalent
would be worse or less natural — backend, deploy, helper, wrapper,
drop-in, endpoint, fingerprint, preshared key, apply, rollback,
runtime, staging, runbook, healthcheck, preflight/postflight, etc.

Translate only where Russian is clearly better: возможности, структура
репозитория, переменные окружения, обзор развёртывания, обслуживание,
база данных, статус проекта, лицензия.

https://claude.ai/code/session_01ARDGi134VgnEyo1FPCeaNd
@Egor051 Egor051 merged commit 14e4a9c into main May 21, 2026
4 checks passed
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