Skip to main content

tr

Macro tr 

Source
macro_rules! tr {
    ($msgctxt:tt => $singular:tt | $plural:tt % $n:expr $(, $($args:tt)*)?) => { ... };
    ($msgctxt:tt => $msgid:tt $(, $($args:tt)*)?) => { ... };
    ($singular:tt | $plural:tt % $n:expr $(, $($args:tt)*)?) => { ... };
    ($msgid:tt $(, $($args:tt)*)?) => { ... };
}
Expand description

Translates a text written in English, in the current language of this library (see the module documentation):

  • tr!("text"), tr!("text with {}", value), tr!("{name}", name = value);
  • tr!("context" => "text", …) for a text that needs a context to be translated right (the same English word for different things);
  • tr!("one file" | "{n} files" % count, …) for a text with a number: each language has its own forms, and {n} is the number.

It returns a String. Arguments are formatted with Display.