From 32740e654aa341f8af67e30b9864f42fd029d2ed Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 25 May 2007 20:06:11 +0000 Subject: [PATCH] Fixed numeric key-modifying lookups. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4722 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/MessageBundle.as | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/as/com/threerings/util/MessageBundle.as b/src/as/com/threerings/util/MessageBundle.as index 96ecbc1f6..1286721c4 100644 --- a/src/as/com/threerings/util/MessageBundle.as +++ b/src/as/com/threerings/util/MessageBundle.as @@ -173,11 +173,26 @@ 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) { - Log.getLog(this).warning("Missing translation message " + - "[bundle=" + _path + ", key=" + key + "]."); + 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 + "]."); - // return something bogus - return (key + args); + // return something bogus + return (key + args); + } } return StringUtil.substitute(msg, args);