use-locale-match 0.1.0

Small locale preference and fallback primitives for RustUse
Documentation
  • Coverage
  • 58.33%
    7 out of 12 items documented1 out of 7 items with examples
  • Size
  • Source code size: 8.49 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 389.25 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-locale
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-locale-match

Small locale preference and fallback primitives for RustUse.

Example

use use_locale_match::{best_locale_match, fallback_chain};

assert_eq!(fallback_chain("zh-Hant-TW"), vec!["zh-Hant-TW", "zh-Hant", "zh"]);
assert_eq!(best_locale_match("en-US", ["en", "fr"]).unwrap().available, "en");

Scope

  • Build simple locale fallback chains.
  • Match one requested locale against available locale tags.
  • Normalize locale tags before comparison.

Non-goals

  • HTTP framework integration.
  • Full Accept-Language parsing.
  • Translation catalogs.
  • Message formatting.
  • CLDR likely-subtag matching.

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license