Skip to content

fix(init): detect native system language - #2

Merged
whitelonng merged 1 commit into
mainfrom
codex/fix-native-locale-detection
Jul 12, 2026
Merged

fix(init): detect native system language#2
whitelonng merged 1 commit into
mainfrom
codex/fix-native-locale-detection

Conversation

@whitelonng

Copy link
Copy Markdown
Owner

What changed

  • Detect macOS language from AppleLanguages, with AppleLocale fallback.
  • Detect Windows UI culture through a direct powershell.exe invocation.
  • Read Linux locale variables including LANGUAGE, LC_MESSAGES, and LANG.
  • Treat C, C.UTF-8, and POSIX as unknown while keeping --lang as the highest-priority override.
  • Add regression coverage for macOS, Windows, and Linux locale selection.
  • Make the Windows smoke workflow verify native UI culture wins over deliberately conflicting terminal locale variables in CMD, PowerShell, and Git Bash.

Why

On a Chinese macOS system, terminal variables could report C.UTF-8 and Node could report en-US, causing mancode init to display English. Windows Git Bash could have a similar mismatch between shell locale and the Windows UI language.

Impact

Initialization now follows the computer UI language reliably on macOS and Windows, while Linux follows its standard locale environment. Explicit --lang zh-CN|en behavior is unchanged.

Validation

  • npm run lint
  • npm run typecheck
  • npm run build
  • npm test (401 tests)
  • npm run test:windows-smoke
  • Real Chinese macOS run with LC_ALL=C.UTF-8
  • git diff --check

@whitelonng
whitelonng marked this pull request as ready for review July 12, 2026 17:35
@whitelonng
whitelonng merged commit 62b92d4 into main Jul 12, 2026
2 checks passed
@whitelonng
whitelonng deleted the codex/fix-native-locale-detection branch July 17, 2026 21:32
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.

1 participant