feat: add support for multi languages (#79)

* update backup settings description

* add rust-i18n

* translate

* .

* update translations

* fix

* update translate

* .
This commit is contained in:
reya
2025-07-04 14:57:22 +07:00
committed by GitHub
parent f9bf29df09
commit c1d5c7e719
36 changed files with 4591 additions and 3171 deletions

30
crates/i18n/src/lib.rs Normal file
View File

@@ -0,0 +1,30 @@
use rust_i18n::Backend;
rust_i18n::i18n!("../../locales");
pub struct I18nBackend;
impl Backend for I18nBackend {
fn available_locales(&self) -> Vec<&str> {
_RUST_I18N_BACKEND.available_locales()
}
fn translate(&self, locale: &str, key: &str) -> Option<&str> {
let val = _RUST_I18N_BACKEND.translate(locale, key);
if val.is_none() {
_RUST_I18N_BACKEND.translate("en", key)
} else {
val
}
}
}
#[macro_export]
macro_rules! init {
() => {
rust_i18n::i18n!(backend = i18n::I18nBackend);
};
}
pub use rust_i18n::set_locale;
pub use rust_i18n::t;