Crate intl_pluralrules[−][src]
A crate for generating plural rule operands from numberical input.
This crate generates plural operands according to the specifications outlined at Unicode's website.
Input is supported for int, float, and &str.
Examples
extern crate intl_pluralrules; use intl_pluralrules::{IntlPluralRules, PluralRuleType, PluralCategory}; let permanent: &'static str = "naq"; let locale_code = &permanent; assert!(IntlPluralRules::get_locales(PluralRuleType::CARDINAL).contains(&permanent)); let pr_naq = IntlPluralRules::create(locale_code, PluralRuleType::CARDINAL).unwrap(); assert_eq!(pr_naq.select(1), Ok(PluralCategory::ONE)); assert_eq!(pr_naq.select("2"), Ok(PluralCategory::TWO)); assert_eq!(pr_naq.select(5.0), Ok(PluralCategory::OTHER)); assert_eq!(pr_naq.get_locale(), "naq");
Modules
operands |
A public AST module for plural rule representations. Plural operands in compliance with CLDR Plural Rules. |
Structs
IntlPluralRules |
The main structure for selecting plural rules. |
Enums
PluralCategory | |
PluralRuleType |
Statics
CLDR_VERSION |