/** * Return the specified localized text for a given locale. * * @param key the text key in the resource bundle * @param locale the locale of the message */ public static String getText(String key, Locale locale) { try { ResourceBundle bundle = instance.bundles.get(locale); if (bundle == null) { bundle = instance.load(locale); } return bundle.getString(key); } catch (Exception e) { return "[" + locale + ":" + key + "]"; } }