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
+19 -4
View File
@@ -173,11 +173,26 @@ public class MessageBundle
// if the base key is not found, look to see if we should try to // 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 // convert our first argument to an Integer and try again
if (msg == null) { if (msg == null) {
Log.getLog(this).warning("Missing translation message " + if (getResourceString(key + ".n", false) != null) {
"[bundle=" + _path + ", key=" + key + "]."); // 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 + "].");
// return something bogus // return something bogus
return (key + args); return (key + args);
}
} }
return StringUtil.substitute(msg, args); return StringUtil.substitute(msg, args);