Leptos updated to 0.5

This commit is contained in:
2023-09-15 13:55:01 +02:00
parent 9dd0993204
commit bbad2bb183
18 changed files with 234 additions and 281 deletions
+5 -5
View File
@@ -24,10 +24,10 @@ lazy_static! {
};
}
fn get_locales(cx: Scope) -> Vec<Option<String>> {
let (loc, set_loc) = create_signal(cx, Vec::new());
fn get_locales() -> Vec<Option<String>> {
let (loc, set_loc) = create_signal(Vec::new());
create_effect(cx, move |_| {
create_effect(move |_| {
let js_locales = window().navigator().languages();
set_loc.update(|l| *l = js_locales.into_iter().map(|val| val.as_string()).collect::<Vec<_>>());
});
@@ -35,8 +35,8 @@ fn get_locales(cx: Scope) -> Vec<Option<String>> {
loc.get_untracked()
}
pub fn get_dictionary(cx: Scope) -> Option<&'static HashMap<&'static str, &'static str>> {
let locs = get_locales(cx);
pub fn get_dictionary() -> Option<&'static HashMap<&'static str, &'static str>> {
let locs = get_locales();
for loc in locs {
if let Some(key) = loc {