PropertiesFile (@NotNull Module module, @NotNull String bundleName, @Nullable Locale locale) { List<PropertiesFile> propFiles = findPropertiesFiles(module, bundleName); if (locale != null) { for(PropertiesFile propFile: propFiles) { if (propFile.getLocale().equals(locale)) { return propFile; } } } // fallback to default locale for(PropertiesFile propFile: propFiles) { if (propFile.getLocale().getLanguage().length() == 0 || propFile.getLocale().equals(Locale.getDefault())) { return propFile; } } // fallback to any file if (!propFiles.isEmpty()) { return propFiles.get(0); } return null; }