2023-09-08 11:53:08 +02:00
|
|
|
use std::borrow::Cow;
|
|
|
|
|
use std::ops::Deref;
|
2023-08-18 12:22:23 +02:00
|
|
|
use leptos::*;
|
|
|
|
|
use crate::locales::catalogues::get_dictionary;
|
|
|
|
|
|
|
|
|
|
mod catalogues;
|
|
|
|
|
|
2023-09-15 13:55:01 +02:00
|
|
|
pub fn trl(phrase: &str) -> impl Fn() -> String {
|
2023-08-18 12:22:23 +02:00
|
|
|
let mut translated = phrase;
|
2023-09-15 13:55:01 +02:00
|
|
|
if let Some(dict) = get_dictionary() {
|
2023-09-08 11:53:08 +02:00
|
|
|
if let Some(p) = dict.get(phrase.to_string().as_str()) {
|
2023-08-18 12:22:23 +02:00
|
|
|
translated = *p;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-08 11:53:08 +02:00
|
|
|
let out = translated.to_string();
|
|
|
|
|
|
|
|
|
|
move || { out.clone() }
|
2023-08-18 12:22:23 +02:00
|
|
|
}
|