01: /*
02: * Created on 10 juin 2005
03: * SalomeTMF is a Test Managment Framework
04: * Copyright (C) 2005 France Telecom R&D
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: * Contact: mikael.marche@rd.francetelecom.com
21: */
22: package org.objectweb.salome_tmf.tools.docbook2pdf.languages;
23:
24: import java.util.Locale;
25: import java.util.ResourceBundle;
26:
27: public class Language {
28: /** Static variable */
29: private static Language language = null;
30:
31: /** Local variable */
32: Locale currentLocale = null;
33:
34: /** For the resource file */
35: ResourceBundle i18n = null;
36: ResourceBundle i18nErr = null;
37: ResourceBundle i18nLog = null;
38:
39: /** Get the instance of the language */
40: public static Language getInstance(Locale locale) {
41: if (language == null) {
42: language = new Language(locale);
43: }
44: return language;
45: }
46:
47: /** Constructor of the language */
48: private Language(Locale locale) {
49: setLocale(locale);
50: }
51:
52: /** Set the local values */
53: public void setLocale(Locale locale) {
54: currentLocale = locale;
55: i18n = ResourceBundle
56: .getBundle(
57: "org/objectweb/salome_tmf/tools/docbook2pdf/languages/i18n",
58: currentLocale);
59: }
60:
61: /* \brief Return the text corresponding to the key
62: * \param
63: */
64: public String getText(String key) {
65: return i18n.getString(key);
66: }
67:
68: /*
69: * \brief Return the log text corresponding to the key
70: * \param key : a log key belong i18nLog
71: */
72: public String getTextLog(String key) {
73: return i18nLog.getString(key);
74: }
75:
76: /*
77: * \brief Return the error text corresponding to the key
78: * \param key : an error key belong i18nErr
79: */
80: public String getTextErr(String key) {
81: return i18nErr.getString(key);
82: }
83: }
|