Skip to content

i18n: resolve WPM catalog at the WinuxCmd install root (#1150) - #1151

Merged
caomengxuan666 merged 1 commit into
mainfrom
fix/i18n-catalog-path
Oct 9, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
fix/i18n-catalog-path

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Root cause

catalog() in src/utils/i18n.cppm looked up the i18n catalog only next to
the executable: <exe-dir>/.wpm/i18n/<locale>/catalog.json, where
<exe-dir> is winuxcmd/usr/bin/ (the parent of winuxcmd.exe).

WPM, however, installs i18n package payloads at the WinuxCmd install
root
: winuxcmd/.wpm/i18n/zh-CN/catalog.json — two levels above the exe
directory. The two paths never matched, so translated catalogs were never
loaded and only WINUX_LANG mattered (with no catalog found, output stayed
English). There was no env override for the catalog path either.

Fix

catalog() now probes candidate roots in order:

  1. <exe-dir>/.wpm/i18n (unchanged behavior, keeps the verified workaround
    from the issue working)
  2. the exe directory's parent and grandparent: <root>/.wpm/i18n, which
    covers the WPM layout <root>/usr/bin/winuxcmd.exe ->
    <root>/.wpm/i18n

The full-locale path and the language-only fallback (zh-CN -> zh) are
tried per root, and the first readable catalog wins.

Verification

  • New regression test
    winuxcmd.i18n_catalog_found_at_wpm_install_root
    (tests/unit/winuxcmd/winuxcmd_unit_test.cpp): builds a
    <root>/usr/bin/winuxcmd.exe + <root>/.wpm/i18n/zh-CN/catalog.json
    layout in a temp dir, runs winuxcmd ls --help with WINUX_LANG=zh-CN,
    and asserts the common.usage message from the catalog is printed. It
    fails on the old lookup and passes with this fix.
  • winuxcmd.* test group: 28/28 passed.
  • Full unit suite: 2772 tests, 2770 passed; the only 2 failures
    (grep.grep_r_skips_cross_junction_trees_without_crashing,
    grep.grep_R_warns_and_terminates_on_junction_cycle) are pre-existing
    environment issues (directory symlink creation requires privilege) and
    are unrelated to this change.
  • Manually verified both layouts (catalog beside the exe and catalog at the
    install root) load translations.

Closes #1150

@caomengxuan666
caomengxuan666 merged commit 661f09b into main Oct 9, 2026
4 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/i18n-catalog-path branch October 9, 2026 12:20
caomengxuan666 added a commit that referenced this pull request Oct 10, 2026
…#1152 (#1153)

- Delete BUG_FIX_PLAN.md and BUG_FIX_STATUS.md: point-in-time snapshots of the 95-bug audit round (2360/2366 tests, K:/coreutils-issues data sources). The fix campaign is long landed and recorded in git history and the CHANGELOG; the stale counts contradict the current state.
- CHANGELOG: replace the empty Unreleased section with entries for the WPM catalog install-root resolution (#1151) and touch -c unmatched literal-glob operands (#1152).

Co-authored-by: docs-audit <[email protected]>
caomengxuan666 added a commit that referenced this pull request Oct 10, 2026
…n locale hint (issue #1155) (#1160)

Bare 'winuxcmd' printed 193 lines of registration-ordered command
summaries with no structure and no discovery guidance. Rework it:

- Group all registered commands into nine GNU coreutils-style sections
  (File operations, Text processing, Compare & patch, Numeric
  operations, Search tools, Checksums & encoding, Shell utilities,
  System & process, Terminal & documentation), alphabetical inside
  each section; uncategorized commands would fall into an 'Other
  utilities' catch-all so new commands stay visible.
- Print a discovery guide before the groups: 'winuxcmd <command>
  --help', 'winuxcmd help <command>', 'winuxcmd --list-all' and
  'wpm search <capability>'.
- Add 'winuxcmd --list-all' for the flat alphabetical listing.
- Detect the system locale with an injection-friendly precedence
  (WINUX_LANG > LC_ALL > LC_MESSAGES > LANG > GetUserDefaultLocaleName)
  and, when it is non-English and the matching WPM i18n catalog
  (#1151) is not installed, print one hint pointing at
  'wpm install winuxcmd-i18n-zh-cn' + WINUX_LANG=zh-CN. English
  locales, explicit WINUX_LANG=off and installed catalogs stay silent.

Command parsing and dispatch are untouched; all 178 registered
commands still dispatch (per-command --version loop green) and the
winuxcmd unit group passes 36/36, including new tests for section
grouping, alphabetical order, bare-vs-list-all parity, and the four
locale-hint states.
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.

[bug] i18n catalog installed by WPM to <root>/.wpm/i18n but runtime looks at <exe-dir>/.wpm/i18n

1 participant