aboutsummaryrefslogtreecommitdiff
path: root/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'base/src')
-rw-r--r--base/src/locale.rs14
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}]")),
}
}