File tree 7 files changed +537
-95
lines changed
7 files changed +537
-95
lines changed Original file line number Diff line number Diff line change 1
1
# CHANGELOG
2
2
3
- ## Unreleased - [ 0.1.6]
3
+ ## 2024-06-27 - [ 0.1.6]
4
4
5
5
### New features
6
6
11
11
- Add ` flag ` field to ` leptos_fluent::Language ` storing emoji flag
12
12
automatic discovered for each language identifier with a country code.
13
13
14
+ ### Bug fixes
15
+
16
+ - Accept [ configuration conditional checks] directly in most macro parameters:
17
+
18
+ ``` rust
19
+ leptos_fluent! {{
20
+ // ...
21
+ #[cfg(debug_assertions)]
22
+ initial_language_from_url_param : true ,
23
+ #[cfg(debug_assertions)]
24
+ set_language_to_url_param : true ,
25
+ }}
26
+ ```
27
+
28
+ [ configuration conditional checks ] : https://doc.rust-lang.org/rust-by-example/attribute/cfg.html
29
+
14
30
## 2024-06-26 - [ 0.1.5]
15
31
16
32
### New features
@@ -321,7 +337,7 @@ version to `0.1` during installation.
321
337
322
338
- Added all ISO-639-1 and ISO-639-2 languages.
323
339
324
- [ 0.1.6 ] : https://github.com/mondeja/leptos-fluent/compare/v0.1.5...master
340
+ [ 0.1.6 ] : https://github.com/mondeja/leptos-fluent/compare/v0.1.5...v0.1.6
325
341
[ 0.1.5 ] : https://github.com/mondeja/leptos-fluent/compare/v0.1.4...v0.1.5
326
342
[ 0.1.4 ] : https://github.com/mondeja/leptos-fluent/compare/v0.1.3...v0.1.4
327
343
[ 0.1.3 ] : https://github.com/mondeja/leptos-fluent/compare/v0.1.2...v0.1.3
Original file line number Diff line number Diff line change @@ -156,6 +156,20 @@ pub fn App() -> impl IntoView {
156
156
fn LanguageSelector () -> impl IntoView { ... }
157
157
```
158
158
159
+ ### How to get values of ` leptos_fluent! ` macro at runtime?
160
+
161
+ Use ` provide_meta_context ` at the macro initialization and get them
162
+ with the method ` I18n::meta ` :
163
+
164
+ ``` rust
165
+ let i18n = leptos_fluent! {{
166
+ // ...
167
+ provide_meta_context : true ,
168
+ }};
169
+
170
+ println! (" Macro parameters: {:?}" , i18n . meta (). unwrap ());
171
+ ```
172
+
159
173
[ `<For/>` ] : https://docs.rs/leptos/latest/leptos/fn.For.html
160
174
[ `leptos_fluent::SsrHtmlTag` ] : https://docs.rs/leptos-fluent/latest/leptos_fluent/fn.SsrHtmlTag.html
161
175
[ `leptos_fluent::Language` ] : https://docs.rs/leptos-fluent/latest/leptos_fluent/struct.Language.html
Original file line number Diff line number Diff line change @@ -605,6 +605,20 @@ leptos_fluent! {{
605
605
}}
606
606
```
607
607
608
+ ### ` provide_meta_context `
609
+
610
+ Provide the macro meta information at runtime as a context.
611
+ Get it using ` I18n::meta ` :
612
+
613
+ ``` rust
614
+ let i18n = leptos_fluent! {{
615
+ // ...
616
+ provide_meta_context : true ,
617
+ }};
618
+
619
+ println! (" Macro parameters: {:?}" , i18n . meta (). unwrap ());
620
+ ```
621
+
608
622
[ `fluent_templates::static_loader!` ] : https://docs.rs/fluent-templates/latest/fluent_templates/macro.static_loader.html
609
623
[ `once_cell:sync::Lazy` ] : https://docs.rs/once_cell/latest/once_cell/sync/struct.Lazy.html
610
624
[ `<html lang="...">` attribute ] : https://developer.mozilla.org/es/docs/Web/HTML/Global_attributes/lang
Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ pub fn App() -> impl IntoView {
15
15
translations: [ TRANSLATIONS ] ,
16
16
locales: "./locales" ,
17
17
check_translations: "./src/**/*.rs" ,
18
+ #[ cfg( debug_assertions) ]
19
+ initial_language_from_url_param: true ,
20
+ #[ cfg( debug_assertions) ]
21
+ set_language_to_url_param: true ,
18
22
} } ;
19
23
20
24
view ! { <LanguageSelector /> }
You can’t perform that action at this time.
0 commit comments