+ try
+ {
+ return MessageFormat.format(rb.getString(key), params);
+ } catch (Exception e)
+ {
+ log.warn("I18N missing: " + loc + "\t" + key);
+ }
+ String value = "[missing key] " + key + "";
+ for (Object p : params)
+ {
+ value += " '" + p.toString() + "'";
+ }
+ return value;
+ }
+
+ /**
+ * Returns the resource bundle text for the given key, with tokens {@code {0},
+ * {1} etc replaced by the supplied parameters. If the key is not found,
+ * returns the key and values prefixed by "[missing key]"
+ *
+ * @param key
+ *
+ * @return
+ */
+ public static String formatMessage(String key, String[] params)
+ {
+ return formatMessage(key, (Object[]) params);