Skip to content

Commit 723cb68

Browse files
authoredAug 2, 2024··
Allow struct field init shorthand for most macro parameters (#195)
1 parent 24da8c8 commit 723cb68

File tree

7 files changed

+654
-416
lines changed

7 files changed

+654
-416
lines changed
 

‎CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# CHANGELOG
22

3+
## 2024-08-02 - [0.1.9]
4+
5+
### Enhancements
6+
7+
- Allow [struct field init shorthand] for `leptos_fluent!` expressions macro
8+
parameters.
9+
10+
[struct field init shorthand]: https://doc.rust-lang.org/book/ch05-01-defining-structs.html#using-the-field-init-shorthand
11+
312
## 2024-07-01 - [0.1.8]
413

514
### New features
@@ -380,6 +389,7 @@ version to `0.1` during installation.
380389

381390
- Added all ISO-639-1 and ISO-639-2 languages.
382391

392+
[0.1.9]: https://github.com/mondeja/leptos-fluent/compare/v0.1.8...v0.1.9
383393
[0.1.8]: https://github.com/mondeja/leptos-fluent/compare/v0.1.7...v0.1.8
384394
[0.1.7]: https://github.com/mondeja/leptos-fluent/compare/v0.1.6...v0.1.7
385395
[0.1.6]: https://github.com/mondeja/leptos-fluent/compare/v0.1.5...v0.1.6

‎Cargo.lock

Lines changed: 227 additions & 196 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎leptos-fluent-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "leptos-fluent-macros"
33
description = "Macros for leptos-fluent"
44
edition.workspace = true
5-
version = "0.1.8"
5+
version = "0.1.9"
66
license = "MIT"
77
documentation.workspace = true
88
repository.workspace = true

‎leptos-fluent-macros/src/loader.rs

Lines changed: 385 additions & 217 deletions
Large diffs are not rendered by default.

‎leptos-fluent-macros/tests/ui/leptos_fluent/fail/empty_parameter.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Expected an expression with 'key: value' or '#[...] key: value' format. Found:
1+
error: Expected an expression with 'key: value', '#[...] key: value', 'key,' or `#[...] key,` format. Found:
22
: "foo",
33
--> tests/ui/leptos_fluent/fail/empty_parameter.rs:17:9
44
|
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use fluent_templates::static_loader;
2+
use leptos::*;
3+
use leptos_fluent_macros::leptos_fluent;
4+
5+
static_loader! {
6+
pub static TRANSLATIONS = {
7+
locales: "../../../../examples/csr-minimal/locales",
8+
fallback_language: "en",
9+
};
10+
}
11+
12+
#[component]
13+
pub fn App() -> impl IntoView {
14+
let cookie_name = "my_cookie";
15+
let initial_language_from_cookie = true;
16+
17+
let i18n = leptos_fluent! {{
18+
translations: [TRANSLATIONS],
19+
cookie_name,
20+
locales: "../../../../examples/csr-minimal/locales",
21+
initial_language_from_cookie,
22+
}};
23+
24+
logging::log!("I18n context: {:?}", i18n.meta().unwrap());
25+
26+
view! { <p>Foo</p> }
27+
}
28+
29+
fn main() {}

‎leptos-fluent/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "leptos-fluent"
33
description = "Fluent framework for internationalization of Leptos applications"
44
edition.workspace = true
5-
version = "0.1.8"
5+
version = "0.1.9"
66
license = "MIT"
77
documentation.workspace = true
88
repository.workspace = true

0 commit comments

Comments
 (0)
Please sign in to comment.