1 21 package oracle.toplink.essentials.internal.localization; 23 24 import java.text.MessageFormat ; 25 import java.util.Locale ; 26 import java.util.ResourceBundle ; 27 28 37 public abstract class ToplinkLocalization { 38 39 42 public static String buildMessage(String localizationClassName, String key, Object [] arguments) { 43 String message = key; 44 ResourceBundle bundle = null; 45 46 if (arguments != null) { 48 for (int i = 0; i < arguments.length; i++) { 49 if (arguments[i] == null) { 50 arguments[i] = "null"; 51 } 52 } 53 } 54 55 bundle = ResourceBundle.getBundle("oracle.toplink.essentials.internal.localization.i18n." + localizationClassName + "Resource", Locale.getDefault()); 56 57 try { 58 message = bundle.getString(key); 59 } catch (java.util.MissingResourceException mre) { 60 bundle = ResourceBundle.getBundle("oracle.toplink.essentials.internal.localization.i18n.ToplinkLocalizationResource", Locale.getDefault()); 63 String noTranslationMessage = bundle.getString("NoTranslationForThisLocale"); 64 65 return MessageFormat.format(message, arguments) + noTranslationMessage; 66 } 67 return MessageFormat.format(message, arguments); 68 } 69 } 70 | Popular Tags |