Skip to content

Commit 2cae13a

Browse files
committed
fix: fixed cast issues with t! interpolation
BREAKING CHANGE: Changed delimiter in `t!` macro variable interpolation from `:` to `=` to solve compiler misinterpretation errors
1 parent 80523a4 commit 2cae13a

File tree

2 files changed

+3
-2
lines changed
  • examples/core/i18n/src/templates
  • packages/perseus/src/translator

2 files changed

+3
-2
lines changed

examples/core/i18n/src/templates/index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn index_page<G: Html>(cx: Scope) -> View<G> {
77

88
view! { cx,
99
p { (t!("hello", {
10-
"user": username
10+
"user" = username
1111
}, cx)) }
1212
a(href = link!("/about", cx)) { "About" }
1313
}

packages/perseus/src/translator/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ macro_rules! t {
6060
};
6161
// When there are arguments to interpolate
6262
($id:expr, {
63-
$($key:literal: $value:expr),+
63+
// NOTE Using a colon here leads to literally impossible to solve cast errors based on compiler misinterpretations
64+
$($key:literal = $value:expr),+
6465
}, $cx:expr) => {{
6566
let mut args = $crate::internal::i18n::TranslationArgs::new();
6667
$(

0 commit comments

Comments
 (0)