5 releases
0.1.4 | May 15, 2022 |
---|---|
0.1.3 | May 14, 2022 |
0.1.2 | May 14, 2022 |
0.1.1 | May 14, 2022 |
0.1.0 | May 10, 2022 |
#256 in Internationalization (i18n)
465KB
8K
SLoC
Contains (autotools obfuscated code, 400KB) c/configure, (obscure autoconf code, 1KB) c/configure.ac
rust-locale
rust_locale
provides various functions dependent on locale specified in POSIX.1.
The main purpose is to provide something that is not in char
methods or that differs in behavior from char
methods.
Dependency
[dependencies]
rust-locale = "0.1"
Examples
use rust_locale::CType;
// space is different from whitespace
assert!('\x0c'.is_space()); # form feed
std::env::set_var("LC_ALL", "en_US");
assert!('\u{2003}'.is_space()); # Em Space
assert!(!'\u{1361}'.is_space()); # Ethiopic Wordspace
std::env::set_var("LC_ALL", "am_ET");
assert!('\u{1361}'.is_space());
// different behavior from char::to_uppercase
std::env::set_var("LC_ALL", "en_US");
assert_eq!(CType::to_uppercase(&'i'), 'I');
std::env::set_var("LC_ALL", "tr_TR");
assert_eq!(CType::to_uppercase(&'i'), '\u{0130}'); # Latin Capital Letter I with Dot Above
These tests may fail depending on the locales' definition.
Future plan
Feature requests are welcome.
License
rust-locale
uses Gnulib for the platform compatibility. Gnulib is LGPL and rust-locale
links to it statically, therefore rust-locale
is also LGPL.
If you use rust-locale
and not want to adapt LGPL, you may need to link to rust-locale
dynamically.
If that is difficult, I will consider linking rust-locale
to Gnulib dynamically and change rust-locale
's license to MIT.