Code example for MessageFormat

Methods: format

0
	public static String get(String key, Object... args) {
		String classkey = StackUtil.getCurrentStackTraceElement(1).getClassName() + "." + key;
		if (bundle != null && bundle.containsKey(classkey)) {
			String message = bundle.getProperty(classkey);
			if (args != null) {
				MessageFormat formatter = new MessageFormat(message,locale);
				return formatter.format(args);
			} 
			return message;
		} 
		String missing = get("missingTranslation",classkey);
		throw new RuntimeException(missing);
	} 
}