1
2
3
4
5
6
7
8 /
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 public interface I18n
43 {
44 /***
45 * Returns configured default locale.
46 *
47 * @return the default locale object.
48 */
49 public Locale getDefaultLocale();
50
51 /***
52 * Returns configured prefered locale.
53 *
54 * @return the prefered locale object.
55 */
56 public Locale getPreferedLocale();
57
58 /***
59 * Returns configured locales.
60 *
61 * @return an array of defined locale.
62 */
63 public Locale[] getSupportedLocales();
64
65 /***
66 * Returns the human readable name of the given locale.
67 *
68 * @param locale the locale.
69 * @return the human readable name of the given locale.
70 */
71 public String getLocaleName(Locale locale);
72
73 /***
74 * Checks if a string value is defined for a default locale.
75 *
76 * @param key the key.
77 * @return <code>true</code> if the string is defined
78 */
79 public boolean defined(String key);
80
81 /***
82 * Checks if a string value is defined for a given locale.
83 *
84 * @param locale the locale.
85 * @param key the key.
86 * @return <code>true</code> if the string is defined
87 */
88 public boolean defined(Locale locale, String key);
89
90 /***
91 * Get the string value.
92 *
93 * @param locale the locale.
94 * @param key the key.
95 * @return the string value.
96 */
97 public String get(Locale locale, String key);
98
99 /***
100 * Get the string value with given default value if the string is missing in
101 * both given and default locale.
102 *
103 * @param locale the locale.
104 * @param key the key.
105 * @param defaultValue the default value in case key mapping is missing.
106 * @return the string value.
107 */
108 public String get(Locale locale, String key, String defaultValue);
109
110 /***
111 * Get the string and replace $[1..n] variables with given values.
112 *
113 * @param locale the locale.
114 * @param key the key.
115 * @param values the values use for substitution.
116 * @return the the output string.
117 */
118 public String get(Locale locale, String key, String ... values);
119
120 /***
121 * Get the string and replace $[1..n] variables with given values.
122 *
123 * @param locale the locale.
124 * @param key the key.
125 * @param values the values use for substitution.
126 * @return the the output string.
127 */
128 public String get(Locale locale, String key, List<String> values);
129
130 /***
131 * Get all keys defined for given locale.
132 *
133 * @param locale the locale.
134 * @return the list of keys.
135 */
136 public Collection<String> getKeys(Locale locale);
137
138 /***
139 * Reload the localization.
140 *
141 */
142 public void reload();
143 }