Code example for MessageFormat

Methods: format, setLocale

0
     * @param key        the resourcebundle key 
     * @param parameters the parameter collection for the message 
     * @return the formated string 
     */ 
    public String formatMessage(final String key, final Object[] parameters) {
        final MessageFormat format = new MessageFormat(getString(key));
        format.setLocale(getLocale());
        return format.format(parameters);
    } 
 
    /** 
     * Returns the current locale for this resource bundle. 
     * @return the locale. 
     */ 
    public Locale getLocale() {
        return locale;
    } 
}