Skip to content

fix(i18n): make the locale fallback test independent of the system locale - #10

Open
ayozetr wants to merge 1 commit into
RaidTheory:mainfrom
ayozetr:fix/i18n-test-locale-independence
Open

fix(i18n): make the locale fallback test independent of the system locale#10
ayozetr wants to merge 1 commit into
RaidTheory:mainfrom
ayozetr:fix/i18n-test-locale-independence

Conversation

@ayozetr

@ayozetr ayozetr commented Aug 12, 2026

Copy link
Copy Markdown

unknown_tag_resolves_to_english only holds on machines whose own locale is English or unsupported. resolve_locale consults the system UI language whenever the preferred tag is unknown, so on a Spanish system the unknown tag "xx" falls through to "es" and the assertion fails:

assertion `left == right` failed
  left: "es"
 right: "en"

That makes cargo test unreliable for contributors outside those locales — it fails on a clean checkout with nothing actually wrong.

Splits the fallback chain into resolve_locale_from, which takes the system language as an argument, and asserts against that. Also adds coverage for the system-language fallback itself, which had none.

Reproduce on main with LANG=es_ES.UTF-8 cargo test --lib i18n. Context in #8.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…cale

`resolve_locale` consults the machine's UI language whenever the preferred
tag is unknown, so `unknown_tag_resolves_to_english` only held on machines
whose own locale is English or unsupported. On a Spanish system the unknown
tag "xx" falls through to "es" and the test fails, which makes `cargo test`
unreliable for contributors outside those locales.

Split the fallback chain into `resolve_locale_from`, which takes the system
language as an argument, and assert against that instead. Also covers the
system-language fallback itself, which had no test.
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