Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/resources/Resources.java @ 417:e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
flys-artifacts/trunk@1882 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 10 May 2011 15:28:30 +0000 |
parents | 8a4c219fd0ee |
children | e0fec407a280 |
rev | line source |
---|---|
125
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.resources; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
413
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
3 import java.text.MessageFormat; |
125
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.util.Locale; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.util.MissingResourceException; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.util.ResourceBundle; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import org.apache.log4j.Logger; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.CallMeta; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 /** |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 * This class provides methods for i18n. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 * |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 */ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 public class Resources { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 /** The logger that is used in this class.*/ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 private static Logger logger = Logger.getLogger(Resources.class); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 /** The singleton instance.*/ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 private static Resources INSTANCE; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 /** The locales supported by this server.*/ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 protected Locale[] locales; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 /** |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * No instance of this class is necessary. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 */ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 private Resources() { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 /** |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * Returns the locales supported by this server. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 * |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 * @return the supported locales. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 */ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 public Locale[] getLocales() { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 if (locales == null) { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 readLocales(); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 return locales; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 /** |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 * Read the locales configured for this server. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 */ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 protected void readLocales() { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 // TODO IMPLEMENT ME |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 locales = new Locale[2]; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 locales[0] = Locale.GERMANY; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 locales[1] = Locale.ENGLISH; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 /** |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * This method returns the translated value for <i>key</i> or <i>def</i> if |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 * <i>key</i> is not existing in the resource bundle. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 * |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 * @param meta The CallMeta object of the request that contains the |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 * preferred locale. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 * @param key The key that should be translated. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 * @param def A default value that is returned, if <i>key</i> was not found. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 * @return the translated message. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 */ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 public static String getMsg(CallMeta meta, String key, String def) { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 if (INSTANCE == null) { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 INSTANCE = new Resources(); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 Locale[] locales = INSTANCE.getLocales(); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 Locale locale = meta.getPreferredLocale(locales); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 return getMsg(locale, key, def); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 /** |
413
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
85 * Returns a translated message based on a template specified by <i>key</i> |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
86 * that has necessary values to be filled in. |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
87 * |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
88 * @param meta The CallMeta object. |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
89 * @param key The key of the template in the resource bundle. |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
90 * @param def the default value if no template was found with <i>key</i>. |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
91 * @param args The arguments that are necessary for the template. |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
92 * |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
93 * @return a translated string. |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
94 */ |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
95 public static String getMsg( |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
96 CallMeta meta, |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
97 String key, |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
98 String def, |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
99 Object[] args) |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
100 { |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
101 String template = getMsg(meta, key, null); |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
102 |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
103 if (template == null) { |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
104 return def; |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
105 } |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
106 |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
107 return MessageFormat.format(template, args); |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
108 } |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
109 |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
110 |
8a4c219fd0ee
Added a method to Resources that returns translated compound messages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
125
diff
changeset
|
111 /** |
125
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 * This method returns the translated value for <i>key</i> or <i>def</i> if |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 * <i>key</i> is not existing in the resource bundle. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 * |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 * @param locale The locale. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 * @param key The key that should be translated. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 * @param def A default value that is returned, if <i>key</i> was not found. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 * |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 * @return the translated message. |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 */ |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 public static String getMsg(Locale locale, String key, String def) { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 ResourceBundle bundle = ResourceBundle.getBundle("messages", locale); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 try { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 return bundle.getString(key); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 catch (MissingResourceException mre) { |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 logger.warn("No message found for key: " + key); |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 return def; |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 } |
25593857b8f8
Implemented a singleton instance that provides i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |