public static String format(String bundleName, Locale locale, String key, Object[] args) {
        if (locale == null) {
            // When formatting Date objects and such, MessageFormat
            // cannot have a null Locale.
            locale = Locale.getDefault();
        }

        String value = getString(bundleName, locale, key);
        if (args == null) {
            args = NO_ARGS;
        }

        // FIXME: after switching to JDK 1.4, it will be possible to clean
        // this up by providing the Locale along with the string in the
        // constructor to MessageFormat.  Until 1.4, the following workaround
        // is required for constructing the format with the appropriate locale:
        MessageFormat messageFormat = new MessageFormat("");
        messageFormat.setLocale(locale);
        messageFormat.applyPattern(value);

        return messageFormat.format(args);
    }
public static String format ( String bundleName , Locale locale , String key , Object [ ] args ) { if ( locale == null ) { locale = Locale . getDefault ( ) ; } String value = getString ( bundleName , locale , key ) ; if ( args == null ) { args = NO_ARGS ; } MessageFormat messageFormat = new MessageFormat ( "" ) ; messageFormat . setLocale ( locale ) ; messageFormat . applyPattern ( value ) ; return messageFormat . format ( args ) ; }
Looks up the value for <code>key</code> in the
<code>ResourceBundle</code> referenced by
<code>bundleName</code>, then formats that value for the
specified <code>Locale</code> using <code>args</code>.

@return Localized, formatted text identified by
<code>key</code>.