Fixed suffix determination for message pluralization.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5359 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2008-09-04 23:19:56 +00:00
parent 76ebba1614
commit d5546a37fb
+11 -7
View File
@@ -219,13 +219,17 @@ public class MessageBundle
*/ */
protected function getSuffix (args :Array) :String protected function getSuffix (args :Array) :String
{ {
if (args.length > 0) { if (args.length > 0 && args[0] != null) {
var count :int = int(args[0]); try {
switch (args[0]) { var count :int = (args[0] is int) ? int(args[0]) :
case NaN: break; // Fall out StringUtil.parseInteger(String(args[0]));
case 0: return ".0"; switch (count) {
case 1: return ".1"; case 0: return ".0";
default: return ".n"; case 1: return ".1";
default: return ".n";
}
} catch (err :ArgumentError) {
// fall out
} }
} }
return ""; return "";