mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 15:45:11 +01:00
fix: prefer terminal locale
This commit is contained in:
parent
5a64e6c6c8
commit
73fa43d761
3 changed files with 29 additions and 7 deletions
|
|
@ -64,7 +64,18 @@ fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
fn init() -> Result<shell::Data, args::Status> {
|
||||
let locale = {
|
||||
let sys_locale = get_locale().unwrap_or("en-US".to_string());
|
||||
let sys_locale = {
|
||||
// use terminal locale if available
|
||||
if let Ok(locale) = env::var("LANG") {
|
||||
locale
|
||||
} else if let Ok(locale) = env::var("LC_ALL") {
|
||||
locale
|
||||
} else if let Ok(locale) = env::var("LC_MESSAGES") {
|
||||
locale
|
||||
} else {
|
||||
get_locale().unwrap_or("en-US".to_string())
|
||||
}
|
||||
};
|
||||
if sys_locale.len() < 2 {
|
||||
"en-US".to_string()
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue