i18n-format for Rust
A quick announcement for
i18n-format
, a Rust crate
to help with string localization. While it's not GNOME specific as it
is only about gettext, I wrote it for GNOME applications.
The goal is to allow the use of gettext!
and ngettext!
while
xgettext can still extract the strings.
Simple use:
use i18n_format::i18n_fmt;
let number = 1;
let s = i18n_fmt! {
i18n_fmt("This is number {}, make it so !", number)
};
In your po/meson.build
, make sure to have:
i18n.gettext(gettext_package,
args [
'--keyword=i18n_fmt',
'--keyword=i18n_nfmt:1,2'
],
preset: 'glib')
If you use the regular
gtk-rust-template
,
that's probably all that needs to happen.
Don't forget to check the documentation, or the code.