From c74d39c2a867f8f5c16bb32e1b181aa61cbf1d58 Mon Sep 17 00:00:00 2001 From: KokaKiwi Date: Mon, 23 Dec 2024 20:48:30 +0100 Subject: [PATCH] Update fluent-templates dependency to 0.12 --- Cargo.lock | 50 ++++++++++++++++++++++----- examples/csr-complete/Cargo.toml | 4 +-- examples/csr-minimal/Cargo.toml | 4 +-- examples/ssr-hydrate-actix/Cargo.toml | 6 ++-- examples/ssr-hydrate-axum/Cargo.toml | 6 ++-- leptos-fluent/Cargo.toml | 6 ++-- leptos-fluent/src/lib.rs | 5 +-- 7 files changed, 57 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1dfd15..83d9936 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "actix-codec" @@ -900,6 +900,20 @@ dependencies = [ "walkdir", ] +[[package]] +name = "fluent-template-macros" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98a7b1d2fc1d7edcd008dd871aea0309be4f8ecfd4fa0388a8f261c6798ab138" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", + "unic-langid", + "walkdir", +] + [[package]] name = "fluent-templates" version = "0.11.0" @@ -909,7 +923,25 @@ dependencies = [ "fluent-bundle", "fluent-langneg", "fluent-syntax", - "fluent-template-macros", + "fluent-template-macros 0.11.0", + "intl-memoizer", + "log", + "once_cell", + "thiserror 1.0.69", + "unic-langid", + "walkdir", +] + +[[package]] +name = "fluent-templates" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "600669b30905c0c6d69fe3bb897be7ea535b2c904c0c7a6546ada888b0542dbf" +dependencies = [ + "fluent-bundle", + "fluent-langneg", + "fluent-syntax", + "fluent-template-macros 0.12.0", "intl-memoizer", "log", "once_cell", @@ -1582,7 +1614,7 @@ version = "0.2.0" dependencies = [ "current_locale", "directories", - "fluent-templates", + "fluent-templates 0.12.0", "leptos", "leptos-fluent-macros", "leptos_meta", @@ -1595,7 +1627,7 @@ name = "leptos-fluent-csr-complete-example" version = "0.1.0" dependencies = [ "console_error_panic_hook", - "fluent-templates", + "fluent-templates 0.12.0", "leptos", "leptos-fluent", ] @@ -1605,7 +1637,7 @@ name = "leptos-fluent-csr-minimal-example" version = "0.1.0" dependencies = [ "console_error_panic_hook", - "fluent-templates", + "fluent-templates 0.12.0", "leptos", "leptos-fluent", ] @@ -1614,7 +1646,7 @@ dependencies = [ name = "leptos-fluent-end2end-tests" version = "0.1.0" dependencies = [ - "fluent-templates", + "fluent-templates 0.11.0", "leptos", "leptos-fluent", "leptos-fluent-csr-complete-example", @@ -1633,7 +1665,7 @@ dependencies = [ "cfg-expr", "current_platform", "fluent-syntax", - "fluent-templates", + "fluent-templates 0.11.0", "globwalk", "json5", "leptos", @@ -1657,7 +1689,7 @@ dependencies = [ "actix-files", "actix-web", "console_error_panic_hook", - "fluent-templates", + "fluent-templates 0.12.0", "leptos", "leptos-fluent", "leptos_actix", @@ -1672,7 +1704,7 @@ version = "0.1.0" dependencies = [ "axum", "console_error_panic_hook", - "fluent-templates", + "fluent-templates 0.12.0", "leptos", "leptos-fluent", "leptos_axum", diff --git a/examples/csr-complete/Cargo.toml b/examples/csr-complete/Cargo.toml index 17c83fa..04eb03b 100644 --- a/examples/csr-complete/Cargo.toml +++ b/examples/csr-complete/Cargo.toml @@ -11,9 +11,9 @@ path = "src/lib.rs" [dependencies] leptos = { version = "0.7", features = ["csr"] } leptos-fluent = { path = "../../leptos-fluent", features = ["json"] } -fluent-templates = { version = "0.11", default-features = false, features = [ +fluent-templates = { version = "0.12", default-features = false, features = [ "macros", - "walkdir" + "walkdir", ] } console_error_panic_hook = "0" diff --git a/examples/csr-minimal/Cargo.toml b/examples/csr-minimal/Cargo.toml index bfd3fa4..b1a4297 100644 --- a/examples/csr-minimal/Cargo.toml +++ b/examples/csr-minimal/Cargo.toml @@ -11,9 +11,9 @@ path = "src/lib.rs" [dependencies] leptos = { version = "0.7", features = ["csr"] } leptos-fluent = { path = "../../leptos-fluent" } -fluent-templates = { version = "0.11", default-features = false, features = [ +fluent-templates = { version = "0.12", default-features = false, features = [ "macros", - "walkdir" + "walkdir", ] } console_error_panic_hook = "0.1" diff --git a/examples/ssr-hydrate-actix/Cargo.toml b/examples/ssr-hydrate-actix/Cargo.toml index a19951a..d6f7548 100644 --- a/examples/ssr-hydrate-actix/Cargo.toml +++ b/examples/ssr-hydrate-actix/Cargo.toml @@ -16,9 +16,9 @@ leptos_meta = "0.7" leptos_actix = { version = "0.7", optional = true } leptos_router = "0.7" leptos-fluent = { path = "../../leptos-fluent" } -fluent-templates = { version = "0.11", default-features = false, features = [ +fluent-templates = { version = "0.12", default-features = false, features = [ "macros", - "walkdir" + "walkdir", ] } wasm-bindgen = "=0.2.99" @@ -35,7 +35,7 @@ ssr = [ "leptos_meta/ssr", "leptos_router/ssr", "leptos-fluent/ssr", - "leptos-fluent/actix" + "leptos-fluent/actix", ] [package.metadata.leptos] diff --git a/examples/ssr-hydrate-axum/Cargo.toml b/examples/ssr-hydrate-axum/Cargo.toml index f311a8f..ac84b21 100644 --- a/examples/ssr-hydrate-axum/Cargo.toml +++ b/examples/ssr-hydrate-axum/Cargo.toml @@ -16,11 +16,11 @@ leptos_meta = "0.7" leptos_axum = { version = "0.7", optional = true } leptos_router = "0.7" leptos-fluent = { path = "../../leptos-fluent", features = [ - "yaml" + "yaml", ], default-features = false } -fluent-templates = { version = "0.11", default-features = false, features = [ +fluent-templates = { version = "0.12", default-features = false, features = [ "macros", - "walkdir" + "walkdir", ] } wasm-bindgen = "=0.2.99" diff --git a/leptos-fluent/Cargo.toml b/leptos-fluent/Cargo.toml index 028c504..989bb49 100644 --- a/leptos-fluent/Cargo.toml +++ b/leptos-fluent/Cargo.toml @@ -12,9 +12,9 @@ keywords.workspace = true [dependencies] leptos-fluent-macros = { path = "../leptos-fluent-macros" } -fluent-templates = { version = ">=0.9", default-features = false, features = [ +fluent-templates = { version = ">=0.12", default-features = false, features = [ "macros", - "walkdir" + "walkdir", ] } leptos = "0.7" leptos_meta = "0.7" @@ -34,7 +34,7 @@ default = [] system = [ "dep:current_locale", "dep:directories", - "leptos-fluent-macros/system" + "leptos-fluent-macros/system", ] nightly = ["leptos-fluent-macros/nightly"] tracing = ["leptos-fluent-macros/tracing", "dep:tracing"] diff --git a/leptos-fluent/src/lib.rs b/leptos-fluent/src/lib.rs index ce0ea43..363bac4 100644 --- a/leptos-fluent/src/lib.rs +++ b/leptos-fluent/src/lib.rs @@ -301,6 +301,7 @@ use leptos::{ guards::ReadGuard, use_context, Read, RwSignal, Set, Signal, With, }, }; +use std::borrow::Cow; /// Direction of the text #[derive(Debug)] @@ -685,7 +686,7 @@ pub fn tr_impl(i18n: I18n, text_id: &str) -> String { pub fn tr_with_args_impl( i18n: I18n, text_id: &str, - args: &std::collections::HashMap, + args: &std::collections::HashMap, FluentValue>, ) -> String { let I18n { language, @@ -740,7 +741,7 @@ macro_rules! tr { $crate::tr_with_args_impl($crate::expect_i18n(), $text_id, &{ let mut map = ::std::collections::HashMap::new(); $( - map.insert($key.to_string(), $value.into()); + map.insert($key.into(), $value.into()); )* map })