Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/bin/edit/localization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ const S_LANG_LUT: [[&str; LangId::Count as usize]; LocId::Count as usize] = [
static mut S_LANG: LangId = LangId::en;

pub fn init() {
// WARNING:
// Generic language tags such as "zh" MUST be sorted after more specific tags such
// as "zh-hant" to ensure that the prefix match finds the most specific one first.
const LANG_MAP: &[(&str, LangId)] = &[
("en", LangId::en),
// ----------------
Expand All @@ -954,11 +957,11 @@ pub fn init() {
let langs = sys::preferred_languages(&scratch);
let mut lang = LangId::en;

for l in langs {
'outer: for l in langs {
for (prefix, id) in LANG_MAP {
if l.starts_with_ignore_ascii_case(prefix) {
lang = *id;
break;
break 'outer;
}
}
}
Expand Down