aboutsummaryrefslogtreecommitdiff
path: root/ui/src
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/locale.rs5
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 {