#locale #i18n #localization #nostd

sys-locale

Small and lightweight library to obtain the active system locale

3 unstable releases

0.2.1 Jun 17, 2022
0.2.0 Mar 1, 2022
0.1.0 May 13, 2021

#10 in Internationalization (i18n)

Download history 10666/week @ 2022-03-06 10612/week @ 2022-03-13 13531/week @ 2022-03-20 12036/week @ 2022-03-27 12126/week @ 2022-04-03 9631/week @ 2022-04-10 9854/week @ 2022-04-17 11172/week @ 2022-04-24 10372/week @ 2022-05-01 10480/week @ 2022-05-08 10796/week @ 2022-05-15 9850/week @ 2022-05-22 9819/week @ 2022-05-29 9443/week @ 2022-06-05 12027/week @ 2022-06-12 10254/week @ 2022-06-19

41,880 downloads per month
Used in 28 crates (6 directly)

MIT/Apache

14KB
273 lines

sys-locale

crates.io version crate documentation MSRV crates.io downloads CI

A small and lightweight Rust library to obtain the locale the active locale on the system.

sys-locale is small library for obtaining the current locale set for the system or application with the relevant platform APIs. The library is also no_std compatible, relying only on alloc, except on Linux and BSD.

Platform support currently includes:

  • Android
  • iOS
  • macOS
  • Linux, BSD, and other UNIX variations
  • WebAssembly
  • Windows
use sys_locale::get_locale;

let locale = get_locale().unwrap_or_else(|| String::from("en-US"));

println!("The current locale is {}", locale);

MSRV

The Minimum Supported Rust Version is currently 1.46.0. This will be bumped to the latest stable version of Rust when needed.

Credits

Made with ❤️ by the 1Password team.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–2.2MB
~42K SLoC