ChoiceFormat class.
ChoiceFormat converts between ranges of numeric values and string names for those ranges.
A ChoiceFormat splits the real number line -Inf to +Inf into two or more contiguous ranges. Each range is mapped to a string. ChoiceFormat is generally used in a MessageFormat for displaying grammatically correct plurals such as "There are 2 files."
- $string = '[0] are no files |[1] is one file |(1,Inf] are {number} files';
- $formatter = new MessageFormat(...); //init for a source
- $translated = $formatter->format($string);
- $choice = new ChoiceFormat();
- echo $choice->format($translated, 0); //shows "are no files"
The message/string choices are separated by the pipe "|" followed by a set notation of the form
Located in /I18N/core/ChoiceFormat.php (line 56)
Constructor.
For the choice string, and a number, find and return the string that satisfied the set within the choices.
Determine if the given number belongs to a given set
Parse a choice string and get a list of sets and a list of strings corresponding to the sets.
Documentation generated on Sun, 04 Jun 2006 18:58:23 -0400 by phpDocumentor 1.3.0RC4