[][src]Function internationalization::i18n::t

pub fn t(key: &str, locale: &str) -> String

Translates by key

Panics

If a key is missing, the code will panic If a locale is not present for the key, ths will also panic

Example

use internationalization::t;

fn main() {
    init_i18n!("locales/*.json", "fr", "en");
     
    let res = t("err.not_allowed");
    assert_eq!("You are not allowed to do this", res);
}