tkv

Macro tkv 

Source
macro_rules! tkv {
    ($msg:literal) => { ... };
}
Expand description

A macro that generates a translation key and corresponding value pair from a given input value.

It’s useful when you want to use a long string as a key, but you don’t want to type it twice.

§Arguments

  • msg - The input value.

§Returns

A tuple of (key, msg).

§Example

use rust_i18n::{t, tkv};


let (key, msg) = tkv!("Hello world");
// => key is `"Hello world"` and msg is the translated message.
// => If there is hints the minify_key logic, the key will returns a minify key.