Skip to content

feat: add i18n support with Chinese (zh) translation#55

Open
Ethan-Tang wants to merge 1 commit into
mylee04:mainfrom
Ethan-Tang:feat/i18n-zh-cn
Open

feat: add i18n support with Chinese (zh) translation#55
Ethan-Tang wants to merge 1 commit into
mylee04:mainfrom
Ethan-Tang:feat/i18n-zh-cn

Conversation

@Ethan-Tang

Copy link
Copy Markdown

Summary

Add i18n support, making all notification strings translatable. Ships with Chinese (zh) as the first non-English locale.

Changes

  • New: lang.sh — Translation engine, locale stored in ~/.claude/notifications/lang
  • notifier.sh — All hardcoded English strings replaced with $(t key) calls
  • global.sh — New cn lang command + language in status
  • bin/code-notify — Added lang to command whitelist
  • help.sh — Documented lang command

Usage

cn lang zh       # 切换为中文
cn lang en       # Switch to English (default)
cn lang status   # Show current language

Design

  • Backward compatible — defaults to English
  • Extensible — add new locale by copying zh case block
  • Zero new dependencies — pure bash
  • Follows existing ~/.claude/notifications/ config pattern

@mylee04 mylee04 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the PR. The macOS/Linux Bash path looks promising, and I verified locally that cn lang zh, cn lang status, and translated notifier output work with a fake notifier. The existing suite also passes.

I do not think this is ready to merge yet because the feature is only partially wired and currently lacks regression coverage for the new behavior.

Requested changes:

  • Move lang out of the SOUND COMMANDS section in help.sh and add it to the top-level COMMANDS list. It is a top-level command, not a sound subcommand.
  • Add README/docs usage for cn lang zh, cn lang en, and cn lang status, including where the language setting is stored.
  • Add a regression test such as tests/test-lang.sh that verifies language persistence and notifier output translation, then wire it into scripts/run_tests.sh.
  • Either add cn lang support to the Windows PowerShell runtime in scripts/install-windows.ps1, or explicitly document that language switching is currently unsupported on Windows. Right now npm Windows users run the PowerShell runtime, so cn lang would not be available there.

Once those are addressed, this should be much safer to merge.

@mylee04

mylee04 commented Jul 3, 2026

Copy link
Copy Markdown
Owner

For visibility, here are the changes needed before this can be merged:

  1. Move lang out of the SOUND COMMANDS section in help.sh and add it to the top-level COMMANDS list.
  2. Add README/docs usage for:
cn lang zh
cn lang en
cn lang status

Also document where the language setting is stored.

  1. Add a regression test such as tests/test-lang.sh that verifies:
  • language persistence
  • cn lang status
  • translated notifier output

Then wire it into scripts/run_tests.sh.

  1. Handle Windows explicitly. Either add cn lang support to scripts/install-windows.ps1, or document that language switching is currently unsupported on Windows. npm Windows users run the PowerShell runtime, so this needs to be clear before merge.

The macOS/Linux Bash path looks promising, but these gaps should be fixed first.

@mylee04 mylee04 added the enhancement New feature or request label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants