mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-28 18:08:46 +03:00
Added default game edition prediction based on system locale
This commit is contained in:
parent
cd76c22812
commit
bc4a246ce1
1 changed files with 16 additions and 1 deletions
|
@ -22,7 +22,22 @@ pub enum GameEdition {
|
|||
|
||||
impl Default for GameEdition {
|
||||
fn default() -> Self {
|
||||
Self::Global
|
||||
let locale = match std::env::var("LC_ALL") {
|
||||
Ok(locale) => locale,
|
||||
Err(_) => match std::env::var("LC_MESSAGES") {
|
||||
Ok(locale) => locale,
|
||||
Err(_) => match std::env::var("LANG") {
|
||||
Ok(locale) => locale,
|
||||
Err(_) => return Self::Global
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if locale.len() > 4 && &locale[..5].to_lowercase() == "zh_cn" {
|
||||
Self::China
|
||||
} else {
|
||||
Self::Global
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue