diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-13 12:50:04 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-13 12:50:04 +0200 |
commit | 55434f87ff252c784e5e00b4775b9555da31ebb0 (patch) | |
tree | fa3b9d95f96584216eb68143edb1cd4d024f0839 /ui | |
parent | 2a41d6b0c7c1327856b9cde247621822fe61355f (diff) | |
download | jellything-55434f87ff252c784e5e00b4775b9555da31ebb0.tar jellything-55434f87ff252c784e5e00b4775b9555da31ebb0.tar.bz2 jellything-55434f87ff252c784e5e00b4775b9555da31ebb0.tar.zst |
translation endpoint
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/locale.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ui/src/locale.rs b/ui/src/locale.rs index 0179c66..442bd9d 100644 --- a/ui/src/locale.rs +++ b/ui/src/locale.rs @@ -19,6 +19,7 @@ static LANG_TABLES: LazyLock<HashMap<Language, HashMap<&'static str, &'static st (Language::English, include_str!("../../locale/en.ini")), (Language::German, include_str!("../../locale/de.ini")), ] { + // TODO fallback to english let tr_map = source .lines() .filter_map(|line| { @@ -39,6 +40,10 @@ pub fn tr(lang: Language, key: &str) -> Cow<'static, str> { } } +pub fn get_translation_table(lang: &Language) -> &'static HashMap<&'static str, &'static str> { + LANG_TABLES.get(lang).unwrap() +} + pub struct TrString<'a>(Cow<'a, str>); impl Render for TrString<'_> { fn render(&self, writer: &mut impl std::fmt::Write) -> std::fmt::Result { |