mondeja / leptos-fluent

Internationalization framework for Leptos using Fluent
https://mondeja.github.io/leptos-fluent/
MIT License
38 stars 10 forks source link

Allow to repeat the same option with different config exprpaths #193

Closed mondeja closed 3 months ago

mondeja commented 3 months ago

For example, allow this:

leptos_fluent! {{
    ...
    #[cfg(debug_assertions)]
    cookie_name: "language",
    #[cfg(not(debug_assertions))]
    cookie_name: "l",
}}

Don't error if expression paths are the same or incompatible between all fields.

Currently, the above code is possible with an expression:

#[cfg(debug_assertions)]
let name = "language";
#[cfg(not(debug_assertions))]
let name = "l";

leptos_fluent! {{
    ...
    cookie_name: name,
}}

But expressions like booleans are evaluated at runtime, which means that dead code can be injected.

Needs #196