Added mechanism for fetching resource strings that doesn't complain when

they don't exist.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1390 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-05-24 20:33:30 +00:00
parent fe645cf2b7
commit b07fbe123b
@@ -1,5 +1,5 @@
//
// $Id: MessageBundle.java,v 1.11 2002/05/08 21:15:26 shaper Exp $
// $Id: MessageBundle.java,v 1.12 2002/05/24 20:33:30 mdb Exp $
package com.threerings.util;
@@ -52,6 +52,19 @@ public class MessageBundle
* Get a String from the resource bundle, or null if there was an error.
*/
protected String getResourceString (String key)
{
return getResourceString(key, true);
}
/**
* Get a String from the resource bundle, or null if there was an
* error.
*
* @param key the resource key.
* @param reportMissing whether or not the method should log an error
* if the resource didn't exist.
*/
protected String getResourceString (String key, boolean reportMissing)
{
try {
if (_bundle != null) {
@@ -59,8 +72,10 @@ public class MessageBundle
}
} catch (MissingResourceException mre) {
Log.warning("Missing translation message " +
"[bundle=" + _path + ", key=" + key + "].");
if (reportMissing) {
Log.warning("Missing translation message " +
"[bundle=" + _path + ", key=" + key + "].");
}
}
return null;
}