diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-05-05 22:50:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 22:50:23 +0000 |
commit | 81ce93574f62d4b117fdd79af65391f30316a457 (patch) | |
tree | 951a0578860c6028e2dfff0ca83879001c6b2385 /alacritty_terminal/src/locale.rs | |
parent | 04f0bcaf54ed373128ca0f84ee8fcdd8e52bce23 (diff) | |
download | alacritty-81ce93574f62d4b117fdd79af65391f30316a457.tar.gz alacritty-81ce93574f62d4b117fdd79af65391f30316a457.zip |
Extend style guideline documentation
Diffstat (limited to 'alacritty_terminal/src/locale.rs')
-rw-r--r-- | alacritty_terminal/src/locale.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/alacritty_terminal/src/locale.rs b/alacritty_terminal/src/locale.rs index 183b4805..dfa878ec 100644 --- a/alacritty_terminal/src/locale.rs +++ b/alacritty_terminal/src/locale.rs @@ -31,7 +31,7 @@ pub fn set_locale_environment() { if !env_locale_ptr.is_null() { let env_locale = unsafe { CStr::from_ptr(env_locale_ptr).to_string_lossy() }; - // Assume `C` locale means unchanged, since it is the default anyways + // Assume `C` locale means unchanged, since it is the default anyways. if env_locale != "C" { debug!("Using environment locale: {}", env_locale); return; @@ -40,13 +40,13 @@ pub fn set_locale_environment() { let system_locale = system_locale(); - // Set locale to system locale + // Set locale to system locale. let system_locale_c = CString::new(system_locale.clone()).expect("nul byte in system locale"); let lc_all = unsafe { setlocale(LC_ALL, system_locale_c.as_ptr()) }; - // Check if system locale was valid or not + // Check if system locale was valid or not. if lc_all.is_null() { - // Use fallback locale + // Use fallback locale. debug!("Using fallback locale: {}", FALLBACK_LOCALE); let fallback_locale_c = CString::new(FALLBACK_LOCALE).unwrap(); @@ -54,7 +54,7 @@ pub fn set_locale_environment() { env::set_var("LC_CTYPE", FALLBACK_LOCALE); } else { - // Use system locale + // Use system locale. debug!("Using system locale: {}", system_locale); env::set_var("LC_ALL", system_locale); @@ -71,6 +71,7 @@ fn system_locale() -> String { // `localeIdentifier` returns extra metadata with the locale (including currency and // collator) on newer versions of macOS. This is not a valid locale, so we use // `languageCode` and `countryCode`, if they're available (macOS 10.12+): + // // https://developer.apple.com/documentation/foundation/nslocale/1416263-localeidentifier?language=objc // https://developer.apple.com/documentation/foundation/nslocale/1643060-countrycode?language=objc // https://developer.apple.com/documentation/foundation/nslocale/1643026-languagecode?language=objc |