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): ______________________. 00023 */ 00024 00025 package org.objectweb.cjdbc.common.i18n; 00026 00027 import java.util.MissingResourceException; 00028 import java.util.ResourceBundle; 00029 00030 /** 00031 * This class defines a ConsoleTranslate 00032 * 00033 * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a> 00034 * @version 1.0 00035 */ 00036 public final class ConsoleTranslate extends I18N 00037 { 00038 /** 00039 * GUI message description is stored in a different file 00040 */ 00041 public static final String CONSOLE_LANGUAGE_FILE = "c-jdbc-console-language"; 00042 00043 /** 00044 * Translation bundle for C-JDBC messages 00045 */ 00046 public static ResourceBundle bundle; 00047 00048 static 00049 { 00050 try 00051 { 00052 bundle = ResourceBundle.getBundle(CONSOLE_LANGUAGE_FILE); 00053 } 00054 catch (MissingResourceException e) 00055 { 00056 e.printStackTrace(); 00057 } 00058 } 00059 00060 /** 00061 * @param key the key to translate 00062 * @return translation 00063 * @see I18N#get(ResourceBundle, String) 00064 */ 00065 public static String get(String key) 00066 { 00067 return get(bundle, key); 00068 } 00069 00070 /** 00071 * @param key the key to translate 00072 * @param parameter boolean parameter 00073 * @return translation 00074 * @see I18N#get(ResourceBundle, String, boolean) 00075 */ 00076 public static String get(String key, boolean parameter) 00077 { 00078 return get(bundle, key, parameter); 00079 } 00080 00081 /** 00082 * @param key the key to translate 00083 * @param parameter int parameter 00084 * @return translation 00085 * @see I18N#get(ResourceBundle, String, int) 00086 */ 00087 public static String get(String key, int parameter) 00088 { 00089 return get(bundle, key, parameter); 00090 } 00091 00092 /** 00093 * @param key the key to translate 00094 * @param parameter long parameter 00095 * @return translation 00096 * @see I18N#get(ResourceBundle, String, long) 00097 */ 00098 public static String get(String key, long parameter) 00099 { 00100 return get(bundle, key, parameter); 00101 } 00102 00103 /** 00104 * @param key the key to translate 00105 * @param parameters Object array parameter 00106 * @return translation 00107 * @see I18N#get(ResourceBundle, String, Object[]) 00108 */ 00109 public static String get(String key, Object[] parameters) 00110 { 00111 return get(bundle, key, parameters); 00112 } 00113 00114 /** 00115 * @param key the key to translate 00116 * @param parameter Object parameter 00117 * @return translation 00118 * @see I18N#get(ResourceBundle, String, Object) 00119 */ 00120 public static String get(String key, Object parameter) 00121 { 00122 return get(bundle, key, parameter); 00123 } 00124 }