⬆️ 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

8
Cargo.lock generated
View file

@ -1251,9 +1251,9 @@ dependencies = [
[[package]]
name = "fluent-template-macros"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007d176e568a4f73ad4225df02aa29ccfecffd8eda31ce78da0bc8b4b310f20a"
checksum = "98a7b1d2fc1d7edcd008dd871aea0309be4f8ecfd4fa0388a8f261c6798ab138"
dependencies = [
"flume",
"ignore",
@ -1266,9 +1266,9 @@ dependencies = [
[[package]]
name = "fluent-templates"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74f22f61b2c8551163ea13c16a381484e5360b089401c6e47c4bfcf6b62bb7ac"
checksum = "600669b30905c0c6d69fe3bb897be7ea535b2c904c0c7a6546ada888b0542dbf"
dependencies = [
"fluent-bundle",
"fluent-langneg",

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
}),
),
}
}