Crates.io | current_locale |
lib.rs | current_locale |
version | 0.1.1 |
source | src |
created_at | 2021-08-26 23:17:58.495359 |
updated_at | 2021-08-26 23:22:07.914831 |
description | A library to get the user's current locale. |
homepage | https://github.com/i509VCB/current_locale |
repository | https://github.com/i509VCB/current_locale |
max_upload_size | |
id | 442804 |
size | 28,924 |
A rust library for getting the current locale as a language code. The language code returned is in a BCP47 (IETF) format.
Platform | Implemented |
---|---|
Windows | Yes |
Unix | Yes |
macOS | Yes |
Android | No |
iOS | Not fully tested |
The library exposes a single function to get the user's locale from the OS
pub fn current_locale() -> Result<String, LocaleError> {
// Method Implementation...
}
The method either returns a string containing the user's locale as a language code or an error when retrieving the locale from the OS.
os-locale tries to use a few dependencies as possible. However we do necessarily require dependencies on some platforms:
Platform | Dependencies |
---|---|
Windows | winapi, libc |
Unix | None |
macOS & iOS | objc, objc-foundation |
os-locale is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See the LICENSE-APACHE and LICENSE-MIT files in this repository for more information.