From b07fbe123bf928a9a941fea006942b2ed8ed8999 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 24 May 2002 20:33:30 +0000 Subject: [PATCH] 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 --- .../com/threerings/util/MessageBundle.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/util/MessageBundle.java b/src/java/com/threerings/util/MessageBundle.java index 52b9f9076..07df7b47d 100644 --- a/src/java/com/threerings/util/MessageBundle.java +++ b/src/java/com/threerings/util/MessageBundle.java @@ -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; }