Skip to main content

t

Macro t 

Source
macro_rules! t {
    ($lang:expr, $en:literal, $zh:literal) => { ... };
    ($lang:expr, $en:literal, $zh:literal, $($arg:tt)*) => { ... };
}
Expand description

Pick between an English and a Chinese message, applying format arguments to whichever is selected.

t!(lang, "Endpoint reachable, {}ms", "端点可达,{}ms", ms)

Both literals take the same arguments, so a mismatched placeholder count is a compile error rather than a runtime surprise.