support index locales that do not include country (e.g. 'en')

This commit is contained in:
Hans-Christoph Steiner 2017-04-18 23:17:22 +02:00
parent 2586e87524
commit 50982060ac

View File

@ -373,7 +373,14 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
private void setLocalized(Map<String, Map<String, Object>> localized) { // NOPMD
Locale defaultLocale = Locale.getDefault();
String languageTag = defaultLocale.getLanguage();
String localeTag = languageTag + "-" + defaultLocale.getCountry();
String countryTag = defaultLocale.getCountry();
String localeTag;
if (TextUtils.isEmpty(countryTag)) {
localeTag = languageTag;
} else {
localeTag = languageTag + "-" + countryTag;
}
Set<String> locales = localized.keySet();
Set<String> localesToUse = new LinkedHashSet<>();