Function sys_locale::get_locale[][src]

pub fn get_locale() -> Option<String>
Expand description

Returns the active locale for the system or application.

Returns

Returns Some(String) with a BCP-47 language tag inside. If the locale couldn’t be obtained, None is returned instead.

Example

use sys_locale::get_locale;

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

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