[pr-tests] darner-core i18n: unit tests for tag resolution, precedence and catalog placeholders #317
Loading…
Reference in a new issue
No description provided.
Delete branch "elgibbone/i18n-and-catalogs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What it changes
Extracts small helpers (parse_saved_language, select, lookup_in, format_template) and adds six tests: tag normalisation; explicit > environment > saved > system, with auto/system using the OS list; saved settings strip a BOM and keep the last entry; untranslated keys fall back to English; templates replace numbered arguments and keep other braces; every bundled catalog is sorted, unique and keeps English's placeholders.
Behaviour is the same as on main: the OS language list is still read only when no language is set (andrewpozdnakov7-jpg's
1e1d4da, kept as their commit). lookup_in sits below text, so lookup keeps its place and #154, #196 and #217 still merge.How it was tested
3c342decargo test -p darner-core --locked: 39 passed, 0 failedcargo clippy -p darner-core --all-targets --locked -- -D warnings, and with--all-features: cleancargo xwin clippy --target x86_64-pc-windows-msvc: cleancargo xtask policy: 555 files ok1e1d4da).Checklist
main.docs/asset-policy.md.Checked for overlap
One production detail changed in the refactor. On main, the OS language list is queried only for the system fallback. On
c9291a617,initializequeries it before selecting even an explicit, environment or saved language.1e1d4da passes a lazy iterator to the same selector. In a fixture using its production initialization code, the four configured-language cases went from one OS lookup to zero. Auto and the default still queried once, and all six cases chose the same catalog. The six existing i18n tests and asset policy passed.
If you cherry-pick or rebase the contribution, please keep the Git author. If you fold it into your own commit, please add this trailer.
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>Thanks, you're right, the eager system_languages() call was a behaviour change. I fast-forwarded the branch to your
1e1d4daunchanged, so it keeps you as the author. On1e1d4da, on macOS (aarch64):cargo test -p darner-core --locked39 passed; both clippy gates on darner-core clean for the host and forx86_64-pc-windows-msvc(cargo-xwin). Not run on Windows.Add unit tests for i18n tag resolution, precedence and catalog placeholdersto [pr-tests] darner-core i18n: unit tests for tag resolution, precedence and catalog placeholdersView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.