Macro i18n_format::i18n_fmt

source ·
i18n_fmt!() { /* proc-macro */ }
Expand description

Wrapper macro to use gettextrs::gettext! or gettextrs::ngettext! in a way that allow xgettext to find strings for .po files as it doesn’t support a keyword with a !.

use i18n_format::i18n_fmt;

let number = 1;
let s = i18n_fmt! {
    i18n_fmt("This is number {}, make it so !", number)
};

let count = 2;
let message = i18n_fmt! {
    i18n_nfmt("Counted {} item", "Counted {} items", count, count)
};

Both i18n_fmt and i18n_nfmt are placeholders, in the block for i18n_fmt! either will be replaced by a call to gettextrs::gettext! or gettextrs::ngettext!, respectively. Specify i18n_fmt and i18n_nfmt:1,2 as keywords for calls to xgettext.