Skip to content

Translation guide

Winenv supports English (en-US) and Simplified Chinese (zh-CN) across the CLI, installer, repository entry points, and documentation.

English is canonical. It lives in:

  • English literals in src/*.ps1 and install.ps1 (win.ps1 is the compatibility entry point);
  • root-locale documentation pages under docs/src/content/docs/;
  • root repository policy files such as CONTRIBUTING.md.

Simplified Chinese lives in:

  • locales/zh-CN.json for CLI output;
  • docs/src/content/docs/zh/ for the documentation site;
  • .zh-CN.md policy and README counterparts.

The English resource file documents the locale schema and leaves English mappings empty because source strings are already English.

The CLI and installer resolve language in this order:

  1. explicit -Lang or -Language parameter;
  2. WINENV_LANG environment variable;
  3. persisted language in %LOCALAPPDATA%\Winenv\config.json;
  4. current Windows UI culture (zh-* selects Chinese; everything else selects English).

Passing auto deliberately skips environment and stored preferences for that invocation and consults the system UI culture. win lang auto persists that behavior.

The documentation uses English at /winenv/ and Chinese at /winenv/zh/. At the English entry page only, a saved manual choice takes priority over the browser language. Explicit language URLs and deep links are never overridden. The standard language menu switches to the equivalent page and remembers the choice when browser storage is available. Storage being blocked does not prevent navigation.

  • Preserve command names, flags, paths, environment variables, package IDs, code, JSON keys, and log fragments.
  • Prefer natural user-facing language over a word-for-word translation.
  • Keep terms such as WinGet, Scoop, mise, Profile, manifest, bucket, Release, Issue, and Pull Request when translation would make cross-referencing harder.
  • Translate intent consistently: adopt means adding a reproducible claim without reinstalling; reuse means an existing compatible installation satisfies the plan; unclaimed does not mean uninstalled.
  • Do not promise safety, support, or compatibility beyond the English source.
  • Update links so a Chinese page normally stays within /zh/ and an English page stays in the root locale.

English CLI text is the fallback key. Add an exact entry for fixed text, a narrowly anchored regular expression for dynamic text, or a replacement only when the phrase is unambiguous. Avoid broad expressions that can translate package names or upstream output.

After changing user-facing text:

Terminal window
pwsh -NoProfile -File ./scripts/test-i18n.ps1
pwsh -NoProfile -File ./scripts/test.ps1
pnpm docs:build

The localization test validates resource JSON, language precedence, persistence, automatic culture detection, table output, and the rule that CLI host output passes through localization wrappers.

A new language requires more than one JSON file. It needs a maintained CLI resource, installer messages, documentation, translated custom navigation, browser routing, automated tests, and reviewers able to keep it current. Starlight supplies standard UI translations and fallback content, but fallback does not meet Winenv’s complete Chinese coverage policy. Start with a design issue that identifies long-term maintainers before implementation.