Skip to content

Translate project to English - #1

Open
DrGekoz wants to merge 1 commit into
andywang425:devfrom
DrGekoz:translate-to-english
Open

Translate project to English#1
DrGekoz wants to merge 1 commit into
andywang425:devfrom
DrGekoz:translate-to-english

Conversation

@DrGekoz

@DrGekoz DrGekoz commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Localizes the entire project to English: code comments, docstrings, user-facing API response messages, configuration defaults, documentation (README.md, AGENTS.md), shell scripts, and test files.

Changes

  • API response messages now return English: account not found (404), unauthorized (401), and the service.py business-failure reasons (auth cookie has expired..., fetch failed: ..., this account has no OpenCode Go subscription, failed to parse usage data from the page...).
  • Config defaults localized for consistency:
    • fetch.locale default zh -> en
    • response.data_template default words translated to Rolling / Weekly / Monthly
  • Docs / scripts / config example fully translated.
  • Tests updated to match the translated messages; all 58 pass (uv run pytest).

Notes

  • The parser remains locale-independent by design (it locates usage items by data-slot structure, not label text), so pages served in any locale still parse correctly.
  • The test fixture DOM_HTML_EN covers a non-default-locale page; the Chinese invalid-account-ID test case ("中文") is kept intentionally to verify such IDs are rejected.

Localize all code comments, docstrings, user-facing API messages,
config defaults, docs (README, AGENTS.md), scripts, and tests to
English.

- fetch.locale default changed zh -> en
- response.data_template default words translated (Rolling/Weekly/Monthly)
- user-facing API reason strings translated (404/401 + business errors)
- all test assertions updated to match the translated messages
- 58 tests pass
@andywang425
andywang425 changed the base branch from master to dev August 6, 2026 17:01
@andywang425

Copy link
Copy Markdown
Owner

Thanks for your translation work! My English is not good so i use deepseek to help me review your PR and write this review :)

A few adjustments before this can merge:

Keep English for all user- and deployer-facing strings (no change needed)

This service must be self-hosted (it carries per-account auth cookies), so every operator is also a user. English is correct for: the API response messages (account not found 404, unauthorized 401, the service.py business reasons), the default response.data_template (Rolling / Weekly / Monthly), the pyproject.toml description, the ConfigError messages in config.py, the CLI error prefix in cli.py, the gen-cert.sh output and usage text, and the comments in config.example.toml.

Restore Chinese for maintainer-facing code comments

The project is maintained in Chinese by me (with limited English proficiency :( ), so please revert the following to Chinese (the original text is preserved in git history on master):

  • Code comments and docstrings across all modules, including the test files.
  • AGENTS.md.

README: bilingual instead of fully English

The fully-English README drops the existing Chinese documentation, which this project wants to keep. Please:

  • Keep the translated README.md in English as the default entry.
  • Add a Chinese version as README.zh-CN.md (restore the pre-PR Chinese README from git history rather than re-translating).
  • Add a language-switch link at the top of README.md, e.g. English | 简体中文.

DOM fixture: actually exercise a non-default locale

The PR description says DOM_HTML_EN covers a non-default-locale page, but since this PR also changes the default fetch.locale from zh to en, English is now the default — so both DOM_HTML and DOM_HTML_EN end up English and the non-default-locale path is no longer tested. That coverage is what backs the parser's "locale-independent" claim, so please make one fixture a genuine non-English page again — e.g. restore DOM_HTML to Chinese (滚动用量 / 重置于 5 小时 0 分钟) and keep DOM_HTML_EN for English, updating the corresponding assertions in tests/test_parser.py (e.g. reset_text "5 小时 0 分钟").

Thanks again, happy to answer any questions.

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