1 package edu.asu.cri.MirkE.util;
2
3 import java.util.ResourceBundle;
4
5 /***
6 * This class hanles all the locale specific information that is to be
7 * presented. <code>getMessage()</code> method can be used to get the locale
8 * specific message for the given key.
9 *
10 * @author Siva B.S.D.S
11 * @version $Id: MirkeMessages.java,v 1.2 2005/01/11 04:03:57 smenor Exp $
12 */
13 public class MirkeMessages
14 {
15 /***
16 * Name of the messages resource
17 */
18 private static final String RESOURCE_NAME =
19 MirkeProperties.getProperty("messages.resourcename");
20
21 /***
22 * Resource bundle holding all the locale specific mirke messages
23 */
24 private static ResourceBundle messages = null;
25
26 /***
27 * This method loads all the locale specific messages
28 */
29 private static void loadMessages()
30 {
31 try
32 {
33 messages = ResourceBundle.getBundle(RESOURCE_NAME);
34 }
35 catch (Throwable exception)
36 {
37 exception.printStackTrace();
38 }
39 }
40
41 /***
42 * Returns the locale specific message for the given key
43 *
44 * @param messageKey message key
45 * @return message
46 */
47 public static String getMessage(String messageKey)
48 {
49 if (messages == null)
50 {
51 loadMessages();
52 }
53 return messages.getString(messageKey);
54 }
55 }