/** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param args An array of objects to place in corresponding variables * @return Returns the formatted message. */ public static String getString(Object caller, String key, Object[] args) throws MissingResourceException { return getMessage(caller, BASE_NAME, null, key, args); }
/** * Gets a string message from the resource bundle for the given key * * @param key The resource key * @return The message */ public String getString(String key) throws MissingResourceException { return getString(key, (Object[]) null); }
protected Properties loadProperties(String basename, ClassLoader loader, Locale locale, Properties props) { String language = locale.getLanguage(); String country = locale.getCountry(); String variant = locale.getVariant(); if (variant != null) { if (variant.trim().length() == 0) { variant = null; } } if (language != null) { if (country != null) { if (variant != null) { props = merge(props, loadProperties( basename + "_" + language + "_" + country + "_" + variant + PROPERTY_EXT, loader)); } props = merge(props, loadProperties(basename + "_" + language + "_" + country + PROPERTY_EXT, loader)); } props = merge(props, loadProperties(basename + "_" + language + PROPERTY_EXT, loader)); } return props; }
loadProperties(name, cl, locale, defaultLocale);
protected Properties loadProperties(String basename, ClassLoader loader, Locale locale, Properties props) { String language = locale.getLanguage(); String country = locale.getCountry(); String variant = locale.getVariant(); if (variant != null) { if (variant.trim().length() == 0) { variant = null; } } if (language != null) { if (country != null) { if (variant != null) { props = merge(props, loadProperties( basename + "_" + language + "_" + country + "_" + variant + PROPERTY_EXT, loader)); } props = merge(props, loadProperties(basename + "_" + language + "_" + country + PROPERTY_EXT, loader)); } props = merge(props, loadProperties(basename + "_" + language + PROPERTY_EXT, loader)); } return props; }
loadProperties(name, cl, locale, defaultLocale);
/** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @return The formatted message */ public static String getString(Object caller, String key) throws MissingResourceException { return getMessage(caller, BASE_NAME, null, key, null); }
p = loadProperties(basename, loader, locale, p); p = loadProperties(basename, loader, defaultLocale, p); p = merge(p, loadProperties(basePropertyFileName, loader));
/** * Gets a string message from the resource bundle for the given key * * @param key The resource key * @return The message */ public String getString(String key) throws MissingResourceException { return getString(key, (Object[]) null); }
/** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param args An array of objects to place in corresponding variables * @return Returns the formatted message. */ public static String getString(Object caller, String key, Object[] args) throws MissingResourceException { return getMessage(caller, BASE_NAME, null, key, args); }
p = loadProperties(basename, loader, locale, p); p = loadProperties(basename, loader, defaultLocale, p); p = merge(p, loadProperties(basePropertyFileName, loader));
/** * <p>Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:</p> * <dir> * This message has two variables: {0} and {1} * </dir> * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The message */ public String getString(String key, Object arg0) throws MissingResourceException { Object[] o = new Object[1]; o[0] = arg0; return getString(key, o); }
/** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @return The formatted message */ public static String getString(Object caller, Locale locale, String key) throws MissingResourceException { return getMessage(caller, BASE_NAME, locale, key, null); }
/** * <p>Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:</p> * <dir> * This message has two variables: {0} and {1} * </dir> * * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The message */ public String getString(String key, Object arg0) throws MissingResourceException { Object[] o = new Object[1]; o[0] = arg0; return getString(key, o); }
/** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param locale The locale * @param key The resource key * @return The formatted message */ public static String getString(Object caller, Locale locale, String key) throws MissingResourceException { return getMessage(caller, BASE_NAME, locale, key, null); }
/** * <p>Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:</p> * <dir> * This message has two variables: {0} and {1} * </dir> * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The message */ public String getString(String key, Object arg0, Object arg1) throws MissingResourceException { Object[] o = new Object[2]; o[0] = arg0; o[1] = arg1; return getString(key, o); }
/** * Get a message from resource.properties from the package of the given object. * * @param caller The calling object, used to get the package name and class loader * @param key The resource key * @param arg0 The argument to place in variable {0} * @return The formatted message */ public static String getString(Object caller, String key, Object arg0) throws MissingResourceException { Object[] o = new Object[1]; o[0] = arg0; return getMessage(caller, BASE_NAME, null, key, o); }
/** * <p>Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:</p> * <dir> * This message has two variables: {0} and {1} * </dir> * * @param key The resource key * @param arg0 The argument to place in variable {0} * @param arg1 The argument to place in variable {1} * @return The message */ public String getString(String key, Object arg0, Object arg1) throws MissingResourceException { Object[] o = new Object[2]; o[0] = arg0; o[1] = arg1; return getString(key, o); }