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 pr_naq = IntlPluralRules::create("naq", 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));

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