Crate gettextrs [] [src]

gettext C library FFI binding for Rust

Usage:

use gettextrs::*; 

setlocale(LocaleCategory::LcAll, "en_US.UTF-8");

bindtextdomain("hellorust", "/usr/local/share/locale");
textdomain("hellorust");

println!("Translated: {}", gettext("Hello, world!"));
println!("Singular: {}", ngettext("One thing", "Multiple things", 1));
println!("Plural: {}", ngettext("One thing", "Multiple things", 2));

Enums

LocaleCategory

Locale category enum ported from locale.h

Functions

bind_textdomain_codeset
bindtextdomain

Bind text domain to some directory containing gettext MO files

dcgettext

Translate msgid to localized message from specified domain using custom locale category

dcngettext

Translate msgid to localized message from specified domain using custom locale category (with plural support)

dgettext

Translate msgid to localized message from specified domain

dngettext

Translate msgid to localized message from specified domain (with plural support)

gettext

Translate msgid to localized message from default domain

ngettext

Translate msgid to localized message from default domain (with plural support)

setlocale

Set current locale for translations

textdomain

Switch to specific text domain