mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-03 16:32:22 +00:00
fix(lang): pick the Kazakh and Georgian translations from the system locale (#16670)
With no language chosen in Settings, resolve_lang takes the language from the system locale prefix. Kazakh locales are kk_* and Georgian locales are ka_*, but their translation tables are keyed kz and ge, so both fell through to English. Map kk to kz and ka to ge for the locale-derived language. A language saved in Settings is unchanged.
This commit is contained in:
1 parent
eb6c32bd57
commit
25d2742273
1 file changed
+16
+16
@@ -167,6 +167,12 @@ fn resolve_lang(saved_lang: &str, locale: &str, cjk_fallback: bool) -> String {
|
||||
.map(|x| x.split("_").next().unwrap_or_default())
|
||||
.unwrap_or_default()
|
||||
.to_owned();
|
||||
// The Kazakh and Georgian tables are keyed by country code, not by language code.
|
||||
if lang == "kk" {
|
||||
lang = "kz".to_owned();
|
||||
} else if lang == "ka" {
|
||||
lang = "ge".to_owned();
|
||||
}
|
||||
}
|
||||
if cjk_fallback && is_cjk_lang(&lang) {
|
||||
"en".to_owned()
|
||||
@@ -365,4 +371,14 @@ mod test {
|
||||
assert_eq!(f("", "pt-AO", false), "pt-pt");
|
||||
assert_eq!(f("", "pt-MZ", false), "pt-pt");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve_lang_detects_kazakh_and_georgian_from_locale() {
|
||||
use super::resolve_lang as f;
|
||||
|
||||
assert_eq!(f("", "kk_KZ.UTF-8", false), "kz");
|
||||
assert_eq!(f("", "kk-KZ", false), "kz");
|
||||
assert_eq!(f("", "ka_GE.UTF-8", false), "ge");
|
||||
assert_eq!(f("", "ka-GE", false), "ge");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user