Update lang.rs - Splits ambiguous pt into pt-pt and pt-br (#16155)

* Update lang.rs - Splits ambiguous pt into pt-pt and pt-br

Splits the ambiguous "Português" entry into two explicit options: Português (Portugal) [pt-pt] and Português (Brasil) [pt-br]. The pt_PT.rs translation file already existed in the repo (fully translated, key-complete) but was never wired into lang.rs. Kept the old "pt" and "br" locale codes mapped to ptbr::T for backward compatibility with existing user configs.

* Preserve pt-PT/pt-BR region in automatic locale resolution

Preserve pt-PT/pt-BR region in automatic locale resolution

* Fix pt-pt detection: check region suffix instead of redundant "pt" substring

Fix pt-pt detection: check region suffix instead of redundant "pt" substring

* Normalize legacy pt/br saved lang option to pt-br

Normalize legacy pt/br saved lang option to pt-br

* Normalize legacy pt/br lang option on Web client

* Add regression tests for pt-pt/pt-br locale resolution

* Follow CLDR inheritance for Portuguese regional locales (pt-AO, pt-MZ, etc.)
This commit is contained in:
Ricardo Simões authored and GitHub committed 2026-09-22 16:31:23 +08:00
1 parent 458ffe44c6
commit c6a358afbe
3 files changed
+48 -2

No files matched your search

+3
View File
@@ -1197,6 +1197,9 @@ pub fn get_local_option(key: &str) -> String {
}
}
}
if key == "lang" && (v == "pt" || v == "br") {
return "pt-br".to_owned();
}
v
}