List<String> (@NotNull String baseName, @NotNull Locale locale) { final List<String> result = new ArrayList<>(3); result.add(0, baseName); final String language = locale.getLanguage(); final int languageLength = language.length(); final String country = locale.getCountry(); final int countryLength = country.length(); final String variant = locale.getVariant(); final int variantLength = variant.length(); if (languageLength + countryLength + variantLength == 0) { //The locale is "", "", "". return result; } final StringBuilder temp = new StringBuilder(baseName); temp.append('_'); temp.append(language); if (languageLength > 0) { result.add(0, temp.toString()); } if (countryLength + variantLength == 0) { return result; } temp.append('_'); temp.append(country); if (countryLength > 0) { result.add(0, temp.toString()); } if (variantLength == 0) { return result; } temp.append('_'); temp.append(variant); result.add(0, temp.toString()); return result; }