]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - vendor/wikimedia/cldr-plural-rule-parser/README.md
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / wikimedia / cldr-plural-rule-parser / README.md
diff --git a/vendor/wikimedia/cldr-plural-rule-parser/README.md b/vendor/wikimedia/cldr-plural-rule-parser/README.md
new file mode 100644 (file)
index 0000000..06ef24a
--- /dev/null
@@ -0,0 +1,32 @@
+CLDRPluralRuleParser
+=============
+
+CLDRPluralRuleParser is a PHP library for parsing
+[http://cldr.unicode.org/index/cldr-spec/plural-rules](plural rules) specified in the
+[http://cldr.unicode.org/index](CLDR project).
+
+This library does not contain the rules from the CLDR project, you have to get them yourself.
+
+Here is how you use it:
+
+<pre lang="php">
+use CLDRPluralRuleParser\Evaluator;
+
+// Example for English
+$rules = ['i = 1 and v = 0'];
+$forms = ['syntax error', 'syntax errors'];
+
+for ( $i = 0; $i < 3; $i++ ) {
+       $index = Evaluator::evaluate( $i, $rules );
+       echo "This code has $i {$forms[$i]}\n";
+}
+
+// This code has 0 syntax errors
+// This code has 1 syntax error
+// This code has 2 syntax errors
+</pre>
+
+License
+-------
+
+The project is licensed under the GPL license 2 or later.