fix(i18n): make the locale fallback test independent of the system locale - #10
Open
ayozetr wants to merge 1 commit into
Open
fix(i18n): make the locale fallback test independent of the system locale#10ayozetr wants to merge 1 commit into
ayozetr wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
unknown_tag_resolves_to_englishonly holds on machines whose own locale is English or unsupported.resolve_localeconsults 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:That makes
cargo testunreliable 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
mainwithLANG=es_ES.UTF-8 cargo test --lib i18n. Context in #8.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.