Fixed numeric key-modifying lookups.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4722 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2007-05-25 20:06:11 +00:00
parent cef7e14583
commit 32740e654a
@@ -172,6 +172,20 @@ public class MessageBundle
// if the base key is not found, look to see if we should try to
// convert our first argument to an Integer and try again
if (msg == null) {
if (getResourceString(key + ".n", false) != null) {
// try converting the first arg to an int
try {
var n :Number = parseInt(args[0]);
if (!isNaN(n)) {
args[0] = n;
msg = getResourceString(key + getSuffix(args), false);
}
} catch (err :Error) {
// fall through...
}
}
// if the msg is still null, we have a problem
if (msg == null) {
Log.getLog(this).warning("Missing translation message " +
"[bundle=" + _path + ", key=" + key + "].");
@@ -179,6 +193,7 @@ public class MessageBundle
// return something bogus
return (key + args);
}
}
return StringUtil.substitute(msg, args);
}