* only among .properties files.
* @throws IOException if no .properties file was found
*/
private ResourceBundle getResourceBundle(String resourceFamily) throws IOException {
resourceFamily = resourceFamily.replace('.', '/');
ResourceBundle resourceBundle = this.resourceBundles.get(resourceFamily);
if (resourceBundle != null) {
return resourceBundle;
}
Locale defaultLocale = Locale.getDefault();
String language = defaultLocale.getLanguage();
String country = defaultLocale.getCountry();
String [] suffixes = {".properties",
"_" + language + ".properties",
"_" + language + "_" + country + ".properties"};
for (String suffix : suffixes) {
for (ClassLoader classLoader : getResourceClassLoaders()) {
InputStream in = classLoader.getResourceAsStream(resourceFamily + suffix);
if (in != null) {
final ResourceBundle parentResourceBundle = resourceBundle;
try {
resourceBundle = new PropertyResourceBundle(in) {
{
setParent(parentResourceBundle);
}