Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/1password/sys-locale
A small and lightweight Rust library to obtain the active locale on the system.
https://github.com/1password/sys-locale
Last synced: 7 days ago
JSON representation
A small and lightweight Rust library to obtain the active locale on the system.
- Host: GitHub
- URL: https://github.com/1password/sys-locale
- Owner: 1Password
- License: apache-2.0
- Created: 2021-05-13T16:19:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T23:16:04.000Z (19 days ago)
- Last Synced: 2024-10-26T11:46:27.993Z (18 days ago)
- Language: Rust
- Homepage:
- Size: 39.1 KB
- Stars: 77
- Watchers: 9
- Forks: 15
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# sys-locale
[![crates.io version](https://img.shields.io/crates/v/sys-locale.svg)](https://crates.io/crates/sys-locale)
[![crate documentation](https://docs.rs/sys-locale/badge.svg)](https://docs.rs/sys-locale)
![MSRV](https://img.shields.io/badge/rustc-1.56+-blue.svg)
[![crates.io downloads](https://img.shields.io/crates/d/sys-locale.svg)](https://crates.io/crates/sys-locale)
![CI](https://github.com/1Password/sys-locale/workflows/CI/badge.svg)A small and lightweight Rust library to get the current active locale on the system.
`sys-locale` is small library to get 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 (and derivatives such as watchOS, tvOS, and visionOS)
- macOS
- Linux, BSD, and other UNIX variations
- WebAssembly, for the following platforms:
- Inside of a web browser (via the `js` feature)
- Emscripten (via the `UNIX` backend)
Further support for other WASM targets is dependent on upstream
support in those target's runtimes and specifications.
- Windows```rust
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.56.0. This will be bumped to a newer stable version of Rust when needed.
## Credits
Made with ❤️ by the [1Password](https://1password.com/) 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.