build/deps(egui): bump icu_experimental to v0.2; replace icu_locid -> icu_locale_core

This commit is contained in:
Alain Emilia Anna Zscheile 2024-11-28 21:28:29 +01:00
parent 070fe2c176
commit e0de008f51
2 changed files with 9 additions and 6 deletions

View File

@ -13,8 +13,8 @@ derive-getters.workspace = true
egui = "0.29" egui = "0.29"
fluent-templates = "0.11" fluent-templates = "0.11"
geo.workspace = true geo.workspace = true
icu_experimental = "0.1" icu_experimental = "0.2"
icu_locid = "1.5" icu_locale_core = "2.0.0-beta1"
log = "0.4" log = "0.4"
petgraph.workspace = true petgraph.workspace = true
rfd = "0.15" rfd = "0.15"

View File

@ -1,5 +1,3 @@
use icu_experimental::displaynames::{DisplayNamesOptions, Fallback, LocaleDisplayNamesFormatter};
use icu_locid::{locale, LanguageIdentifier, Locale};
use std::{borrow::Cow, ops::ControlFlow, path::Path, sync::mpsc::Sender}; use std::{borrow::Cow, ops::ControlFlow, path::Path, sync::mpsc::Sender};
use topola::{ use topola::{
@ -381,13 +379,18 @@ impl MenuBar {
) { ) {
ui.menu_button(tr.text("tr-menu-preferences"), |ui| { ui.menu_button(tr.text("tr-menu-preferences"), |ui| {
ui.menu_button(tr.text("tr-menu-preferences-set-language"), |ui| { ui.menu_button(tr.text("tr-menu-preferences-set-language"), |ui| {
use icu_experimental::displaynames::{
DisplayNamesOptions, Fallback, LocaleDisplayNamesFormatter,
};
use icu_locale_core::{locale, LanguageIdentifier, Locale};
let mut display_names_options: DisplayNamesOptions = Default::default(); let mut display_names_options: DisplayNamesOptions = Default::default();
display_names_options.fallback = Fallback::None; display_names_options.fallback = Fallback::None;
for langid in Translator::locales() { for langid in Translator::locales() {
if let Ok(locale) = Locale::try_from_bytes(langid.to_string().as_bytes()) { if let Ok(locale) = Locale::try_from_str(&langid.to_string()) {
if let Ok(formatter) = LocaleDisplayNamesFormatter::try_new( if let Ok(formatter) = LocaleDisplayNamesFormatter::try_new(
&locale.clone().into(), locale.clone().into(),
display_names_options, display_names_options,
) { ) {
// NOTE: I don't know how to reliably detect if there's no display name // NOTE: I don't know how to reliably detect if there's no display name