private static String getResourceBundleString(String key) { if (key == null) { return ""; } String value = RESOURCE_BUNDLE.getString(key); // Replace {*} with a lookup of * if (value != null && value.indexOf('}') > 0) { Matcher matcher = PAT_PARAM_ALPHA.matcher(value); while (matcher.find()) { key = matcher.group(1); try { String text = getResourceBundleString(key); if (text != null) { value = value.replaceAll("\\Q{" + key + "}\\E", text); } } catch (MissingResourceException e) { // ignore error } } } return value; }
public static boolean keyExistsForDefaultLocale(final String key) { try { DEFAULT_BUNDLE.getString(key); return true; } catch (MissingResourceException e) { return false; } }
public static String getDefaultLocaleString(String key) { // TODO Auto-generated method stub try { return DEFAULT_BUNDLE.getString(key); } catch (MissingResourceException e) { // we support the usage of non-resource strings as long as they are wrapped in ! if (key.startsWith("!") && key.endsWith("!")) { return (key.substring(1, key.length() - 1)); } return '!' + key + '!'; } }