/** * ** Gets the Localized value for the specified key. The default String text is return if ** the * specified key does not exist ** @param key The LocalStrings key ** @param dft The default * String text to return if the LocalStrings key does not exist ** @param args An array of * replacement fields ** @return The Localized String text */ public String getString(String key, String dft, Object args[]) { String val = this.getString(key, dft); if ((args != null) && (args.length > 0) && (val != null)) { try { MessageFormat mf = new MessageFormat(val); mf.setLocale(this.locale); StringBuffer sb = mf.format(args, new StringBuffer(), null); return I18N.decodeNewLine(sb).toString(); } catch (Throwable th) { Print.logInfo("Exception: " + key + " ==> " + val); } } return I18N.decodeNewLine(val); }
public String toString(Locale loc, String dftVal) { String dv = (dftVal != null) ? dftVal : this.dft; if ((loc != null) && (this.pkg != null)) { return this.toString(I18N.getI18N(this.pkg, loc), dv); } else { return I18N.decodeNewLine(dv); } }
public String toString(I18N i18n, String dftVal) { String dv = (dftVal != null) ? dftVal : this.dft; if (i18n != null) { return i18n.getString(this.getKey(), dv); } else { return I18N.decodeNewLine(dv); } }
/** * ** Gets the Localized value for the specified key. The default String text is returned ** if * the specified key does not exist ** @param key The LocalStrings key ** @param dft The default * String text to return if the LocalStrings key does not exist ** @return The Localized String * text */ public String getString(String key, String dft) { if (!StringTools.isBlank(key) && (this.resBundle != null)) { RTProperties cfgProps = RTConfig.getConfigFileProperties(); if (!cfgProps.hasProperty(key) || cfgProps.getBoolean(key, true)) { try { String s = this.resBundle.getString(key); if (s != null) { return I18N.decodeNewLine(s); } } catch (Throwable th) { // Print.logException("",th); // MissingResourceException - if no object for the given key can be found // ClassCastException - if the object found for the given key is not a string } } } return I18N.decodeNewLine(dft); }
public String getDefault(boolean decodeNewLine) { return decodeNewLine ? I18N.decodeNewLine(this.dft) : this.dft; // never null }
public String getDefault() { return I18N.decodeNewLine(this.dft); // never null }