1 /*
2 * XMLCV - Gestion de CV sous forme XML
3 *
4 * Copyright (C) 2004-2005, Damien Raude-Morvan
5 *
6 * This file is part of XMLCV.
7 *
8 * XMLCV is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * XMLCV is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with XMLCV; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * Contacts :
23 * - Sébastien Mathy <smathy@tuxfamily.org>
24 * - Emmanuel Berre <eberre@tuxfamily.org>
25 * - Damien Raude-Morvan <drazzib@drazzib.com>
26 */
27 package org.xmlcv.util;
28
29 import java.util.MissingResourceException;
30 import java.util.ResourceBundle;
31
32 /***
33 * i18n of XMLCV
34 *
35 * @version $Revision: 114 $
36 * @author <a href="mailto:drazzib@drazzib.com">Damien Raude-Morvan </a>
37 */
38 public class I18n {
39
40 private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
41 .getBundle(Config.BUNDLE_NAME);
42
43 /***
44 * Hide public constructor
45 */
46 private I18n() {
47 // Disable default constructor
48 }
49
50 /***
51 * @param key
52 * key of the string. Ex: <code>Menubar.File</code>
53 * @return String translation of the <code>key</code>
54 */
55 public static String getString(String key) {
56 try {
57 return RESOURCE_BUNDLE.getString(key);
58 } catch (MissingResourceException e) {
59 return '!' + key + '!';
60 }
61 }
62 }