PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Integration: #3819 move name_sort_key above the test module
aiongg51a5d4ef51fa
diff --git a/crates/ui-egui/src/i18n/mod.rs b/crates/ui-egui/src/i18n/mod.rsindex ce4fa52b5..78309706e 100644--- a/crates/ui-egui/src/i18n/mod.rs+++ b/crates/ui-egui/src/i18n/mod.rs@@ -614,6 +614,27 @@ pub fn trn(lang: Lang, n: u64, one: &str, other: &str) -> String {fmt(text, &[("n", &n.to_string())])}+/// `name` lowercased with the Latin accents that occur in language names folded away, so a+/// byte-wise sort reads alphabetically. Other scripts are left as they are.+fn name_sort_key(name: &str) -> String {+ name.chars()+ .flat_map(char::to_lowercase)+ .map(|c| match c {+ 'à'..='å' | 'ā' | 'ă' | 'ą' => 'a',+ 'ç' | 'ć' | 'č' => 'c',+ 'è'..='ë' | 'ē' | 'ě' | 'ę' | 'ế' | 'ệ' => 'e',+ 'ì'..='ï' | 'ī' => 'i',+ 'ñ' | 'ń' | 'ň' => 'n',+ 'ò'..='ö' | 'ø' | 'ő' => 'o',+ 'ś' | 'š' => 's',+ 'ù'..='ü' | 'ū' | 'ů' | 'ű' => 'u',+ 'ý' | 'ÿ' => 'y',+ 'ź' | 'ż' | 'ž' => 'z',+ c => c,+ })+ .collect()+}+#[cfg(test)]mod tests {use super::catalog::{Entry, parse_entries, placeholders};@@ -3642,27 +3663,6 @@ mod tests {}}-/// `name` lowercased with the Latin accents that occur in language names folded away, so a-/// byte-wise sort reads alphabetically. Other scripts are left as they are.-fn name_sort_key(name: &str) -> String {- name.chars()- .flat_map(char::to_lowercase)- .map(|c| match c {- 'à'..='å' | 'ā' | 'ă' | 'ą' => 'a',- 'ç' | 'ć' | 'č' => 'c',- 'è'..='ë' | 'ē' | 'ě' | 'ę' | 'ế' | 'ệ' => 'e',- 'ì'..='ï' | 'ī' => 'i',- 'ñ' | 'ń' | 'ň' => 'n',- 'ò'..='ö' | 'ø' | 'ő' => 'o',- 'ś' | 'š' => 's',- 'ù'..='ü' | 'ū' | 'ů' | 'ű' => 'u',- 'ý' | 'ÿ' => 'y',- 'ź' | 'ż' | 'ž' => 'z',- c => c,- })- .collect()-}-#[cfg(test)]mod picker_order_tests {use super::*;