package jalview.util;
import java.text.MessageFormat;
+import java.util.HashSet;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.ResourceBundle.Control;
-//import java.util.logging.Level;
-//import java.util.logging.Logger;
+import java.util.Set;
import org.apache.log4j.Logger;
private static Locale loc;
+ private static Set<String> reportedMissing = new HashSet<>();
+
static
{
try
value = rb.getString(key);
} catch (Exception e)
{
- log.warn("I18N missing: " + loc + "\t" + key);
+ String msg = "I18N missing: " + loc + "\t" + key;
+ logWarning(key, msg);
}
return value;
}
name = rb.getString(smkey);
} catch (Exception x)
{
- log.info("I18N missing key with root " + keyroot + ": " + loc + "\t"
- + smkey); // was FINEST
+ String msg = "I18N missing key with root " + keyroot + ": " + loc + "\t"
+ + smkey;
+ logWarning(smkey, msg);
}
return name;
}
+
+ /**
+ * Logs missing keys (each key once only per run)
+ *
+ * @param key
+ * @param msg
+ */
+ private static void logWarning(String key, String msg)
+ {
+ if (!reportedMissing.contains(key))
+ {
+ reportedMissing.add(key);
+ log.info(msg);
+ }
+ }
}