2 * (c) Copyright IBM Corp. 2000, 2001.
5 package net.sourceforge.phpdt.internal.corext.template.php;
7 import java.text.MessageFormat;
8 import java.util.MissingResourceException;
9 import java.util.ResourceBundle;
11 public class PHPTemplateMessages {
13 private static final String RESOURCE_BUNDLE= PHPTemplateMessages.class.getName();
14 private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
16 private PHPTemplateMessages() {
19 public static String getString(String key) {
21 return fgResourceBundle.getString(key);
22 } catch (MissingResourceException e) {
23 return '!' + key + '!';
28 * Gets a string from the resource bundle and formats it with the argument
30 * @param key the string used to get the bundle value, must not be null
32 public static String getFormattedString(String key, Object arg) {
33 return MessageFormat.format(getString(key), new Object[] { arg });
38 * Gets a string from the resource bundle and formats it with arguments
40 public static String getFormattedString(String key, Object[] args) {
41 return MessageFormat.format(getString(key), args);