/** * Replace the {n} parameters in the string. * * @see java.text.MessageFormat#format(String, Object[]) */ @Override public String get(String key, Object[] args) { return MessageFormat.format(get(key), args); }
/** * With default value and replacement strings. * * @param key key * @param args replacement strings * @param defaultMsg default message * @return the message */ @Override public String getWithDefault(String key, Object[] args, String defaultMsg) { return MessageFormat.format(getWithDefault(key, defaultMsg), args); }
/** * You can provide a default value if the key is not found. * * @param key key * @param defaultMsg the default message * @return the message */ @Override public String getWithDefault(String key, String defaultMsg) { String msg = get(key); if (msg.startsWith("???")) { msg = defaultMsg; } return msg; }