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 salomeTMF_plug.clif.languages;
23:
24: import java.util.Locale;
25: import java.util.ResourceBundle;
26:
27: import org.objectweb.salome_tmf.api.Api;
28:
29: public class Language {
30: /** Static variable */
31: private static Language language = null;
32:
33: /** Local variable */
34: Locale currentLocale = null;
35:
36: /** For the resource file */
37: ResourceBundle i18n = null;
38:
39: // ResourceBundle i18nErr = null;
40: // ResourceBundle i18nLog = null;
41:
42: /** Get the instance of the language */
43: public static Language getInstance() {
44: if (language == null) {
45: language = new Language();
46: }
47: return language;
48: }
49:
50: /** Constructor of the language */
51: private Language() {
52: Locale locale;
53: locale = new Locale(Api.getUsedLocale());
54: setLocale(locale);
55: }
56:
57: /** Set the local values */
58: public void setLocale(Locale locale) {
59: currentLocale = locale;
60: i18n = ResourceBundle.getBundle(
61: "salomeTMF_plug/clif/languages/i18n", currentLocale);
62: }
63:
64: /* \brief Return the text corresponding to the key
65: * \param
66: */
67: public String getText(String key) {
68: return i18n.getString(key);
69: }
70:
71: // /*
72: // * \brief Return the log text corresponding to the key
73: // * \param key : a log key belong i18nLog
74: // */
75: // public String getTextLog(String key){
76: // return i18nLog.getString(key);
77: // }
78: //
79: // /*
80: // * \brief Return the error text corresponding to the key
81: // * \param key : an error key belong i18nErr
82: // */
83: // public String getTextErr(String key){
84: // return i18nErr.getString(key);
85: // }
86: }
|