lingo
Internationalise a Rust program and translate strings quickly and simply. Make any software open to multiple languages
Installation
In your "Cargo.toml" file :
[]
= "*"
Check the current version on crates.io.
Unfortunately, the crate "lingo" already exists in crates.io. Waiting to get the name, be careful to not import "lingo" but "lingo_lib".
How to use
let mut lingo = lingo!;
// If not set, it's the operating system locale that will be used.
lingo.set_context_locale;
// If not set, it's `locale!("en")`.
lingo.set_default_locale;
println!;
-
Locale
locale!; // English (no country code) locale!; // English (United States) from_string; // English (United States) from_string; // English (United States) // English (no country code) Locale; // English (United States) Locale;
Example
A French application using lingo
.
bienvenue sur l'app !
bienvenue sur l'app !
use ;
use ;
use Locale;