Macro kailua_diag::define_msg
[−]
[src]
macro_rules! define_msg { ($(#[$meta:meta])* pub $name:ident $($t:tt)*) => { ... }; ($(#[$meta:meta])* $name:ident $($t:tt)*) => { ... }; }
A helper macro for defining a localizable message.
define_msg! { pub StructName { param: OtherLocalizableType }: "lang1" => "Some localized string with a parameter {param}", "lang2" => "Some other localized string with a differently formatted parameter {param:10}", _ => "The default string with a parameter {param}, normally in English", }
Each parameter should be localizable.
pub
and the parameters can be omitted, and type or lifetime parameters can be given.
(But note that the constructor itself is a struct, so StructName {}
is required
even when there are no message parameters.)
Dependencies
This macro internally depends a parse_generics_shim
crate,
so any crate using this macro should put the following to the Cargo.toml
...
[dependencies]
parse-generics-shim = "*"
...and the following to the crate root.
#[macro_use] extern crate parse_generics_shim;