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
.
let mut lingo = lingo!;
lingo.set_context_locale;
lingo.set_default_locale;
println!;
println!;
Bonjour le monde !
J'adore Lingo
If there were no fr
string, it would use : s!("en_GB", "Hello world!")
.
use HashMap;
use Locale;
use get_string;
use Lingo;
use ;