public static Messages forClass(Class forClass) {
String className = forClass.getName();
String stringsClassName = className.replaceAll("Messages$", "Strings");
Locale locale = Locale.getDefault();
ResourceBundle bundle = ResourceBundle.getBundle(stringsClassName, locale, forClass.getClassLoader());
return new MessagesImpl(locale, bundle);
}
Finds the messages for a given Messages utility class. Strings the trailing "Messages" and replaces it with
"Strings" to form the base path. Loads the bundle using the default locale, and the class' class loader. |