Translation guide
Winenv supports English (en-US) and Simplified Chinese (zh-CN) across the CLI, installer, repository entry points, and documentation.
Source of truth
Section titled “Source of truth”English is canonical. It lives in:
- English literals in
src/*.ps1andinstall.ps1(win.ps1is 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.jsonfor CLI output;docs/src/content/docs/zh/for the documentation site;.zh-CN.mdpolicy and README counterparts.
The English resource file documents the locale schema and leaves English mappings empty because source strings are already English.
Runtime language selection
Section titled “Runtime language selection”The CLI and installer resolve language in this order:
- explicit
-Langor-Languageparameter; WINENV_LANGenvironment variable;- persisted
languagein%LOCALAPPDATA%\Winenv\config.json; - 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.
Translation rules
Section titled “Translation rules”- 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:
adoptmeans adding a reproducible claim without reinstalling;reusemeans an existing compatible installation satisfies the plan;unclaimeddoes 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.
Adding or changing messages
Section titled “Adding or changing messages”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:
pwsh -NoProfile -File ./scripts/test-i18n.ps1pwsh -NoProfile -File ./scripts/test.ps1pnpm docs:buildThe localization test validates resource JSON, language precedence, persistence, automatic culture detection, table output, and the rule that CLI host output passes through localization wrappers.
Adding another language
Section titled “Adding another language”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.
