Merging code from trunk that fixes #774, this work was done by incastrix
[phpeclipse.git] / net.sourceforge.phpeclipse.phpmanual / src / net / sourceforge / phpeclipse / phpmanual / PHPManualUiMessages.java
1 package net.sourceforge.phpeclipse.phpmanual;
2
3
4 import java.text.MessageFormat;
5 import java.util.MissingResourceException;
6 import java.util.ResourceBundle;
7
8 public class PHPManualUiMessages {
9
10         private static final String BUNDLE_NAME = PHPManualUiMessages.class
11                         .getName();
12
13         private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
14                         .getBundle(BUNDLE_NAME);
15
16         private PHPManualUiMessages() {
17         }
18
19         public static String getString(String key) {
20                 try {
21                         return RESOURCE_BUNDLE.getString(key);
22                 } catch (MissingResourceException e) {
23                         return '!' + key + '!';
24                 }
25         }
26
27         public static String getFormattedString(String key, Object arg) {
28                 return MessageFormat.format(getString(key), new Object[] { arg });
29         }
30
31         public static String getFormattedString(String key, Object[] args) {
32                 return MessageFormat.format(getString(key), args);
33         }
34 }