From 25d27422733920926cff0c27f8e37f8fdbd26288 Mon Sep 17 00:00:00 2001 From: Lukas <103962359+L4XB@users.noreply.github.com> Date: Fri, 23 Oct 2026 09:56:15 +0200 Subject: [PATCH] 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. --- src/lang.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lang.rs b/src/lang.rs index 6f02a7ae5..5af8b7035 100644 --- a/src/lang.rs +++ b/src/lang.rs @@ -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"); + } }