KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > common > i18n > GuiTranslate


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Nicolas Modrzyk.
22  * Contributor(s): Emmanuel Cecchet.
23  */

24
25 package org.objectweb.cjdbc.common.i18n;
26
27 import java.util.MissingResourceException JavaDoc;
28 import java.util.ResourceBundle JavaDoc;
29
30 /**
31  * Class to translate the different messages of cjdbc.
32  *
33  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
34  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
35  * @version 1.0
36  */

37
38 public final class GuiTranslate extends I18N
39 {
40
41   /**
42    * GUI message description is stored in a different file
43    */

44   public static final String JavaDoc GUI_LANGUAGE_FILE = "c-jdbc-gui-language";
45
46   /**
47    * Translation bundle for C-JDBC messages
48    */

49   public static ResourceBundle JavaDoc bundle;
50
51   static
52   {
53     try
54     {
55       bundle = ResourceBundle.getBundle(GUI_LANGUAGE_FILE);
56     }
57     catch (MissingResourceException JavaDoc e)
58     {
59       e.printStackTrace();
60     }
61   }
62
63   /**
64    * @param key the key to translate
65    * @return translation
66    * @see I18N#get(ResourceBundle, String)
67    */

68   public static String JavaDoc get(String JavaDoc key)
69   {
70     return get(bundle, key);
71   }
72
73   /**
74    * @param key the key to translate
75    * @param parameter boolean parameter
76    * @return translation
77    * @see I18N#get(ResourceBundle, String, boolean)
78    */

79   public static String JavaDoc get(String JavaDoc key, boolean parameter)
80   {
81     return get(bundle, key, parameter);
82   }
83
84   /**
85    * @param key the key to translate
86    * @param parameter int parameter
87    * @return translation
88    * @see I18N#get(ResourceBundle, String, int)
89    */

90   public static String JavaDoc get(String JavaDoc key, int parameter)
91   {
92     return get(bundle, key, parameter);
93   }
94
95   /**
96    * @param key the key to translate
97    * @param parameter long parameter
98    * @return translation
99    * @see I18N#get(ResourceBundle, String, long)
100    */

101   public static String JavaDoc get(String JavaDoc key, long parameter)
102   {
103     return get(bundle, key, parameter);
104   }
105
106   /**
107    * @param key the key to translate
108    * @param parameters Object array parameter
109    * @return translation
110    * @see I18N#get(ResourceBundle, String, Object[])
111    */

112   public static String JavaDoc get(String JavaDoc key, Object JavaDoc[] parameters)
113   {
114     return get(bundle, key, parameters);
115   }
116
117   /**
118    * @param key the key to translate
119    * @param parameter Object parameter
120    * @return translation
121    * @see I18N#get(ResourceBundle, String, Object)
122    */

123   public static String JavaDoc get(String JavaDoc key, Object JavaDoc parameter)
124   {
125     return get(bundle, key, parameter);
126   }
127 }
Popular Tags