diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-20 17:29:43 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-20 17:29:43 +0200 |
commit | 457aeb41ef9c17215fcc7151b765a19785593096 (patch) | |
tree | 14c52ea28bddab43373559bf3901cd5c2f4742ed /base | |
parent | 096b96f7b00188aa9eda864d53605c6fe73eb63c (diff) | |
download | jellything-457aeb41ef9c17215fcc7151b765a19785593096.tar jellything-457aeb41ef9c17215fcc7151b765a19785593096.tar.bz2 jellything-457aeb41ef9c17215fcc7151b765a19785593096.tar.zst |
even more translation
Diffstat (limited to 'base')
-rw-r--r-- | base/src/locale.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/base/src/locale.rs b/base/src/locale.rs index 188ab63..e7f1592 100644 --- a/base/src/locale.rs +++ b/base/src/locale.rs @@ -25,20 +25,10 @@ static LANG_TABLES: LazyLock<HashMap<Language, HashMap<&'static str, &'static st k }); -pub fn tr(lang: Language, key: &str, args: &[(&str, &str)]) -> Cow<'static, str> { +pub fn tr(lang: Language, key: &str) -> Cow<'static, str> { let tr_map = LANG_TABLES.get(&lang).unwrap(); match tr_map.get(key) { - Some(value) => { - if args.is_empty() { - Cow::Borrowed(value) - } else { - let mut s = value.to_string(); - for (k, v) in args { - s = s.replace(&format!("{{{k}}}"), v) - } - Cow::Owned(s) - } - } + Some(value) => Cow::Borrowed(value), None => Cow::Owned(format!("TR[{key}]")), } } |