Java Message Format format(ResourceBundle bundle, String key, Object... args)

Here you can find the source of format(ResourceBundle bundle, String key, Object... args)

Description

format

License

Apache License

Declaration

public static String format(ResourceBundle bundle, String key, Object... args) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.MessageFormat;

import java.util.MissingResourceException;

import java.util.ResourceBundle;

public class Main {

    public static String format(ResourceBundle bundle, String key, Object... args) {
        try {//from w ww .  jav  a2  s  . co m
            String message = bundle.getString(key);
            return MessageFormat.format(message, args);
        } catch (MissingResourceException e) {
            return '!' + key + '!';
        }
    }

    public static String getString(ResourceBundle bundle, String key) {
        try {
            return bundle.getString(key);
        } catch (MissingResourceException e) {
            return '!' + key + '!';
        }
    }
}

Related

  1. format(final String message, final Object... args)
  2. format(final String template, final Object... arguments)
  3. format(String activity, Object item, Long count, Long total)
  4. format(String key, Object... values)
  5. format(String message, Object argument)
  6. format(String message, Object object)