Closed kornelski closed 6 years ago
https://docs.rs/intl_pluralrules/0.9.0/intl_pluralrules/#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");
What is "naq"?
Why is locale code &&str?
&&str
I guess contains(&permanent) was meant to be contains(locale_code)?
contains(&permanent)
contains(locale_code)
It'd be great to have examples of "cardinal" and "ordinal", since these are specific terms that may not be known by non-native English speakers.
Yep, that's an error. Thanks for noticing! @unclenachoduh
https://docs.rs/intl_pluralrules/0.9.0/intl_pluralrules/#examples
What is "naq"?
Why is locale code
&&str
?I guess
contains(&permanent)
was meant to becontains(locale_code)
?It'd be great to have examples of "cardinal" and "ordinal", since these are specific terms that may not be known by non-native English speakers.