1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
package org.demosys.web.util; |
7 |
|
import java.text.MessageFormat; |
8 |
|
import java.util.ResourceBundle; |
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
0 |
public class MessageUtil { |
14 |
0 |
private static ResourceBundle _resources = |
15 |
|
ResourceBundle.getBundle("struts.application"); |
16 |
|
|
17 |
|
private static String getMessageString(String messageKey) { |
18 |
0 |
return _resources.getString(messageKey); |
19 |
|
} |
20 |
|
|
21 |
|
|
22 |
|
public static String formatMessage(String messageKey) { |
23 |
0 |
MessageFormat mf = new MessageFormat(getMessageString(messageKey)); |
24 |
0 |
return mf.format(new Object[0]); |
25 |
|
} |
26 |
|
|
27 |
|
|
28 |
|
public static String formatMessage(String messageKey, Object arg0) { |
29 |
0 |
MessageFormat mf = new MessageFormat(getMessageString(messageKey)); |
30 |
0 |
Object[] args = new Object[1]; |
31 |
0 |
args[0] = arg0; |
32 |
0 |
return mf.format(args); |
33 |
|
} |
34 |
|
|
35 |
|
|
36 |
|
public static String formatMessage(String messageKey, Object arg0, Object arg1) { |
37 |
0 |
MessageFormat mf = new MessageFormat(getMessageString(messageKey)); |
38 |
0 |
Object[] args = new Object[] {arg0, arg1}; |
39 |
0 |
return mf.format(args); |
40 |
|
} |
41 |
|
} |