1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package se.perfectfools.localizer.i18n;
22
23 import java.util.MissingResourceException;
24 import java.util.ResourceBundle;
25
26 /***
27 * This class handles i18n for ezloc itself.
28 *
29 * @author Pål Brattberg < <a href="mailto:pal@eminds.se">pal@eminds.se </a>>
30 * @version $Id: Messages.java,v 1.2 2004/11/13 13:34:48 pal Exp $
31 */
32 public class Messages {
33
34 private static final String BUNDLE_NAME = "messages";
35 private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
36
37 protected Messages() {
38 }
39
40 /***
41 * Get a translated string for the current locale.
42 *
43 * @param key The key for the String to translate
44 * @return The translated string, or <code>!<em>key</em>!</code> if no
45 * translation was found.
46 */
47 public static String getString(String key) {
48 try {
49 return RESOURCE_BUNDLE.getString(key);
50 } catch (MissingResourceException e) {
51 return '!' + key + '!';
52 }
53 }
54 }