Skip to main content

t_in

Macro t_in 

Source
macro_rules! t_in {
    ($lang:expr, $key:literal) => { ... };
    ($lang:expr, $key:literal, { $($k:expr => $v:expr),* $(,)? }) => { ... };
    ($lang:expr, $key:expr) => { ... };
    ($lang:expr, $key:expr, { $($k:expr => $v:expr),* $(,)? }) => { ... };
}
Expand description

Like t!, but for an explicit LocaleState instead of the global language.

String literal keys get the same compile-time check as t!, and misses are reported to the error handler with the LocaleState’s language.

§Examples

ⓘ
let lang = fluent_zero::LocaleState::new("pt-BR".parse()?);
let title = t_in!(&lang, "app-title");
let welcome = t_in!(&lang, "welcome-user", { "name" => "Alice" });