mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-28 18:08:46 +03:00
fix(i18n): forced format_lang
to return regions for language codes
Standard German language code is `de` but game API requires it to be `de-de`. With this change formatted locales always will have region so always will fit game requirements
This commit is contained in:
parent
da7540ba4b
commit
f109454cb7
1 changed files with 4 additions and 8 deletions
12
src/i18n.rs
12
src/i18n.rs
|
@ -54,14 +54,10 @@ pub fn get_default_lang() -> LanguageIdentifier {
|
|||
}
|
||||
|
||||
pub fn format_lang(lang: &LanguageIdentifier) -> String {
|
||||
let mut formatted = lang.language.to_string();
|
||||
|
||||
if let Some(region) = lang.region {
|
||||
formatted += "-";
|
||||
formatted += ®ion.to_string().to_ascii_lowercase();
|
||||
}
|
||||
|
||||
formatted
|
||||
format!("{}-{}", lang.language, match lang.region {
|
||||
Some(region) => region.to_string().to_ascii_lowercase(),
|
||||
None => lang.language.to_string()
|
||||
})
|
||||
}
|
||||
|
||||
/// Get translated message by key
|
||||
|
|
Loading…
Reference in a new issue