CLDR Plural Rule Parser
Parses CLDR plural rules
|
Parse and evaluate a plural rule. More...
Static Public Member Functions | |
static | evaluate ( $number, array $rules) |
Evaluate a number against a set of plural rules. | |
static | compile (array $rules) |
Convert a set of rules to a compiled form which is optimised for fast evaluation. | |
static | evaluateCompiled ( $number, array $rules) |
Evaluate a compiled set of rules returned by compile(). | |
Parse and evaluate a plural rule.
UTS #35 Revision 33 http://www.unicode.org/reports/tr35/tr35-33/tr35-numbers.html#Language_Plural_Rules
|
static |
Convert a set of rules to a compiled form which is optimised for fast evaluation.
The result will be an array of strings, and may be cached.
array | $rules | The rules to compile |
|
static |
Evaluate a number against a set of plural rules.
If a rule passes, return the index of plural rule.
int | $number | The number to be evaluated against the rules |
array | $rules | The associative array of plural rules in pluralform => rule format. |
|
static |
Evaluate a compiled set of rules returned by compile().
Do not allow the user to edit the compiled form, or else PHP errors may result.
string | int | $number | The number to be evaluated against the rules, in English, or it may be a type convertible to string. |
array | $rules | The associative array of plural rules in pluralform => rule format. |