Fixed localization.
This commit is contained in:
+18
-1
@@ -1,10 +1,27 @@
|
||||
use std::borrow::Cow;
|
||||
use std::ops::Deref;
|
||||
use leptos::*;
|
||||
use crate::locales::catalogues::get_dictionary;
|
||||
|
||||
mod catalogues;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Locales(pub Vec<Option<String>>);
|
||||
|
||||
pub fn init_locales() {
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
{
|
||||
let loc = Locales(
|
||||
window()
|
||||
.navigator()
|
||||
.languages()
|
||||
.into_iter()
|
||||
.map(|val| val.as_string())
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
provide_context(loc);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trl(phrase: &str) -> impl Fn() -> String {
|
||||
let mut translated = phrase;
|
||||
if let Some(dict) = get_dictionary() {
|
||||
|
||||
Reference in New Issue
Block a user