⬆️ Actualiza la versión de fluent_templates

This commit is contained in:
Manuel Cillero 2025-01-04 08:36:22 +01:00
parent c6800e4387
commit 190b685431
3 changed files with 13 additions and 19 deletions

View file

@ -34,7 +34,7 @@ tracing-appender = "0.2.3"
tracing-subscriber = { version = "0.3.19", features = ["json", "env-filter"] }
tracing-actix-web = "0.7.15"
fluent-templates = "0.11.0"
fluent-templates = "0.12.0"
unic-langid = { version = "0.9.5", features = ["macros"] }
actix-web = "4.9.0"

View file

@ -242,20 +242,14 @@ impl L10n {
match &self.op {
L10nOp::None => None,
L10nOp::Text(text) => Some(text.to_owned()),
L10nOp::Translate(key) => {
if self.args.is_empty() {
self.locales.try_lookup(langid, key)
} else {
self.locales.try_lookup_with_args(
langid,
key,
&self.args.iter().fold(HashMap::new(), |mut args, (k, v)| {
args.insert(k.to_string(), v.to_owned().into());
args
}),
)
}
}
L10nOp::Translate(key) => self.locales.try_lookup_with_args(
langid,
key,
&self.args.iter().fold(HashMap::new(), |mut arg, (k, v)| {
arg.insert(k.to_string().into(), v.to_owned().into());
arg
}),
),
}
}