01: /*---------------- FILE HEADER ------------------------------------------
02:
03: This file is part of deegree.
04: Copyright (C) 2001-2008 by:
05: EXSE, Department of Geography, University of Bonn
06: http://www.giub.uni-bonn.de/deegree/
07: lat/lon GmbH
08: http://www.lat-lon.de
09:
10: This library is free software; you can redistribute it and/or
11: modify it under the terms of the GNU Lesser General Public
12: License as published by the Free Software Foundation; either
13: version 2.1 of the License, or (at your option) any later version.
14:
15: This library is distributed in the hope that it will be useful,
16: but WITHOUT ANY WARRANTY; without even the implied warranty of
17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18: Lesser General Public License for more details.
19:
20: You should have received a copy of the GNU Lesser General Public
21: License along with this library; if not, write to the Free Software
22: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23:
24: Contact:
25:
26: Andreas Poth
27: lat/lon GmbH
28: Aennchenstr. 19
29: 53115 Bonn
30: Germany
31: E-Mail: poth@lat-lon.de
32:
33: Prof. Dr. Klaus Greve
34: Department of Geography
35: University of Bonn
36: Meckenheimer Allee 166
37: 53115 Bonn
38: Germany
39: E-Mail: greve@giub.uni-bonn.de
40:
41:
42: ---------------------------------------------------------------------------*/
43: package org.deegree.tools.importer;
44:
45: import java.text.MessageFormat;
46: import java.util.Locale;
47: import java.util.MissingResourceException;
48: import java.util.ResourceBundle;
49:
50: public class Messages {
51:
52: private static final String BUNDLE_NAME = "org.deegree.tools.importer.messages";
53:
54: private Messages() {
55: }
56:
57: public static String getString(String key, Object... arguments) {
58: try {
59: Locale locale = Locale.ENGLISH;
60: ResourceBundle rb = ResourceBundle.getBundle(BUNDLE_NAME,
61: locale);
62: String s = rb.getString(key);
63: if (s != null) {
64: return MessageFormat.format(s, arguments);
65: }
66: return s;
67: } catch (MissingResourceException e) {
68: return "!Cannot find message with key " + key + "!";
69: }
70: }
71: }
|