Using heartbeat api instead

This commit is contained in:
Marco De Araujo 2025-12-22 10:51:58 -04:00
parent 4cedb17b60
commit d024280878
10 changed files with 319 additions and 40 deletions

13
src/i18n/translate.rs Normal file
View file

@ -0,0 +1,13 @@
use crate::i18n::loader::LOCALES;
use fluent_templates::Loader;
use std::str::FromStr;
use unic_langid::LanguageIdentifier;
fn get_sys_locale() -> LanguageIdentifier {
let sys_lang = sys_locale::get_locale().unwrap_or_else(|| String::from("pt-BR"));
LanguageIdentifier::from_str(&sys_lang).expect("Invalid language")
}
pub fn t(key: &str) -> String {
LOCALES.lookup(&get_sys_locale(), key)
}