00001 /** 00002 * C-JDBC: Clustered JDBC. 00003 * Copyright (C) 2002-2004 French National Institute For Research In Computer 00004 * Science And Control (INRIA). 00005 * Contact: c-jdbc@objectweb.org 00006 * 00007 * This library is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU Lesser General Public License as published by the 00009 * Free Software Foundation; either version 2.1 of the License, or any later 00010 * version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00015 * for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 * 00021 * Initial developer(s): Nicolas Modrzyk. 00022 * Contributor(s): Emmanuel Cecchet. 00023 */ 00024 00025 package org.objectweb.cjdbc.common.i18n; 00026 00027 import java.util.MissingResourceException; 00028 import java.util.ResourceBundle; 00029 00030 /** 00031 * Class to translate the different messages of cjdbc. 00032 * 00033 * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a> 00034 * @author <a href="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a> 00035 * @version 1.0 00036 */ 00037 00038 public final class MonitorTranslate extends I18N 00039 { 00040 00041 /** 00042 * GUI message description is stored in a different file 00043 */ 00044 public static final String GUI_LANGUAGE_FILE = "c-jdbc-monitoring-language"; 00045 00046 /** 00047 * Translation bundle for C-JDBC messages 00048 */ 00049 public static ResourceBundle bundle; 00050 00051 static 00052 { 00053 try 00054 { 00055 bundle = ResourceBundle.getBundle(GUI_LANGUAGE_FILE); 00056 } 00057 catch (MissingResourceException e) 00058 { 00059 e.printStackTrace(); 00060 } 00061 } 00062 00063 /** 00064 * @param key the key to translate 00065 * @return translation 00066 * @see I18N#get(ResourceBundle, String) 00067 */ 00068 public static String get(String key) 00069 { 00070 return get(bundle, key); 00071 } 00072 00073 /** 00074 * @param key the key to translate 00075 * @param parameter boolean parameter 00076 * @return translation 00077 * @see I18N#get(ResourceBundle, String, boolean) 00078 */ 00079 public static String get(String key, boolean parameter) 00080 { 00081 return get(bundle, key, parameter); 00082 } 00083 00084 /** 00085 * @param key the key to translate 00086 * @param parameter int parameter 00087 * @return translation 00088 * @see I18N#get(ResourceBundle, String, int) 00089 */ 00090 public static String get(String key, int parameter) 00091 { 00092 return get(bundle, key, parameter); 00093 } 00094 00095 /** 00096 * @param key the key to translate 00097 * @param parameter long parameter 00098 * @return translation 00099 * @see I18N#get(ResourceBundle, String, long) 00100 */ 00101 public static String get(String key, long parameter) 00102 { 00103 return get(bundle, key, parameter); 00104 } 00105 00106 /** 00107 * @param key the key to translate 00108 * @param parameters Object array parameter 00109 * @return translation 00110 * @see I18N#get(ResourceBundle, String, Object[]) 00111 */ 00112 public static String get(String key, Object[] parameters) 00113 { 00114 return get(bundle, key, parameters); 00115 } 00116 00117 /** 00118 * @param key the key to translate 00119 * @param parameter Object parameter 00120 * @return translation 00121 * @see I18N#get(ResourceBundle, String, Object) 00122 */ 00123 public static String get(String key, Object parameter) 00124 { 00125 return get(bundle, key, parameter); 00126 } 00127 }