Example usage for java.text MessageFormat setLocale

List of usage examples for java.text MessageFormat setLocale

Introduction

In this page you can find the example usage for java.text MessageFormat setLocale.

Prototype

public void setLocale(Locale locale) 

Source Link

Document

Sets the locale to be used when creating or comparing subformats.

Usage

From source file:ResourceBundleSupport.java

/**
 * Formats the message stored in the resource bundle (using a
 * MessageFormat).//from   w  w  w . j a  v  a2  s.  c  om
 *
 * @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);
}