MCPcopy Index your code
hub / github.com/1Password/sys-locale

github.com/1Password/sys-locale @v0.3.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.2 ↗ · + Follow
30 symbols 48 edges 10 files 8 documented · 27%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

sys-locale

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

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

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 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.

Extension points exported contracts — how you extend this code

EnvAccess (Interface)
Environment variable access abstraction to allow testing without mutating env variables. Use [StdEnv] to query [std::en [2 …
src/unix.rs

Core symbols most depended-on inside this repo

case
called by 18
src/unix.rs
get_property
called by 7
src/android.rs
get_locales
called by 3
src/lib.rs
get
called by 2
src/unix.rs
posix_to_bcp47
called by 2
src/unix.rs
get_languages
called by 1
src/apple.rs
get
called by 1
src/lib.rs
get_locale
called by 1
src/lib.rs

Shape

Function 21
Class 5
Method 2
Enum 1
Interface 1

Languages

Rust100%

Modules by API surface

src/unix.rs9 symbols
src/apple.rs7 symbols
src/lib.rs4 symbols
src/wasm.rs3 symbols
src/android.rs3 symbols
tests/wasm_worker.rs1 symbols
src/windows.rs1 symbols
gen-windows-bindings/src/main.rs1 symbols
examples/get_locale.rs1 symbols

For agents

$ claude mcp add sys-locale \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact