From cb1b4330ef5e586b0f78b0e17f11531052cd3b8b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 6 Feb 2021 00:37:57 +0100 Subject: [PATCH] App: rename "locales" to "supportedLocales" for clarity --- .../main/java/org/fdroid/fdroid/data/App.java | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/data/App.java b/app/src/main/java/org/fdroid/fdroid/data/App.java index 54e331574..486c3c33b 100644 --- a/app/src/main/java/org/fdroid/fdroid/data/App.java +++ b/app/src/main/java/org/fdroid/fdroid/data/App.java @@ -514,43 +514,43 @@ public class App extends ValueObject implements Comparable, Parcelable { if (systemLocaleList == null) { systemLocaleList = ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()); } - Set localesToUse = localized.keySet(); - setIsLocalized(localesToUse); - String value = getLocalizedEntry(localized, localesToUse, "whatsNew"); + Set supportedLocales = localized.keySet(); + setIsLocalized(supportedLocales); + String value = getLocalizedEntry(localized, supportedLocales, "whatsNew"); if (!TextUtils.isEmpty(value)) { whatsNew = value; } - value = getLocalizedEntry(localized, localesToUse, "video"); + value = getLocalizedEntry(localized, supportedLocales, "video"); if (!TextUtils.isEmpty(value)) { video = value.trim(); } - value = getLocalizedEntry(localized, localesToUse, "name"); + value = getLocalizedEntry(localized, supportedLocales, "name"); if (!TextUtils.isEmpty(value)) { name = value.trim(); } - value = getLocalizedEntry(localized, localesToUse, "summary"); + value = getLocalizedEntry(localized, supportedLocales, "summary"); if (!TextUtils.isEmpty(value)) { summary = value.trim(); } - value = getLocalizedEntry(localized, localesToUse, "description"); + value = getLocalizedEntry(localized, supportedLocales, "description"); if (!TextUtils.isEmpty(value)) { description = formatDescription(value); } - value = getLocalizedGraphicsEntry(localized, localesToUse, "icon"); + value = getLocalizedGraphicsEntry(localized, supportedLocales, "icon"); if (!TextUtils.isEmpty(value)) { iconUrl = value; } - featureGraphic = getLocalizedGraphicsEntry(localized, localesToUse, "featureGraphic"); - promoGraphic = getLocalizedGraphicsEntry(localized, localesToUse, "promoGraphic"); - tvBanner = getLocalizedGraphicsEntry(localized, localesToUse, "tvBanner"); + featureGraphic = getLocalizedGraphicsEntry(localized, supportedLocales, "featureGraphic"); + promoGraphic = getLocalizedGraphicsEntry(localized, supportedLocales, "promoGraphic"); + tvBanner = getLocalizedGraphicsEntry(localized, supportedLocales, "tvBanner"); - wearScreenshots = getLocalizedListEntry(localized, localesToUse, "wearScreenshots"); - phoneScreenshots = getLocalizedListEntry(localized, localesToUse, "phoneScreenshots"); - sevenInchScreenshots = getLocalizedListEntry(localized, localesToUse, "sevenInchScreenshots"); - tenInchScreenshots = getLocalizedListEntry(localized, localesToUse, "tenInchScreenshots"); - tvScreenshots = getLocalizedListEntry(localized, localesToUse, "tvScreenshots"); + wearScreenshots = getLocalizedListEntry(localized, supportedLocales, "wearScreenshots"); + phoneScreenshots = getLocalizedListEntry(localized, supportedLocales, "phoneScreenshots"); + sevenInchScreenshots = getLocalizedListEntry(localized, supportedLocales, "sevenInchScreenshots"); + tenInchScreenshots = getLocalizedListEntry(localized, supportedLocales, "tenInchScreenshots"); + tvScreenshots = getLocalizedListEntry(localized, supportedLocales, "tvScreenshots"); } /** @@ -579,8 +579,8 @@ public class App extends ValueObject implements Comparable, Parcelable { * @see LocaleList */ private String getLocalizedEntry(Map> localized, - Set locales, @NonNull String key) { - Map localizedLocaleMap = getLocalizedLocaleMap(localized, locales, key); + Set supportedLocales, @NonNull String key) { + Map localizedLocaleMap = getLocalizedLocaleMap(localized, supportedLocales, key); if (localizedLocaleMap != null && !localizedLocaleMap.isEmpty()) { for (Object entry : localizedLocaleMap.values()) { return (String) entry; // NOPMD @@ -590,8 +590,8 @@ public class App extends ValueObject implements Comparable, Parcelable { } private String getLocalizedGraphicsEntry(Map> localized, - Set locales, String key) { - Map localizedLocaleMap = getLocalizedLocaleMap(localized, locales, key); + Set supportedLocales, @NonNull String key) { + Map localizedLocaleMap = getLocalizedLocaleMap(localized, supportedLocales, key); if (localizedLocaleMap != null && !localizedLocaleMap.isEmpty()) { for (String locale : localizedLocaleMap.keySet()) { return locale + "/" + localizedLocaleMap.get(locale); // NOPMD @@ -601,8 +601,8 @@ public class App extends ValueObject implements Comparable, Parcelable { } private String[] getLocalizedListEntry(Map> localized, - Set locales, String key) { - Map localizedLocaleMap = getLocalizedLocaleMap(localized, locales, key); + Set supportedLocales, @NonNull String key) { + Map localizedLocaleMap = getLocalizedLocaleMap(localized, supportedLocales, key); if (localizedLocaleMap != null && !localizedLocaleMap.isEmpty()) { for (String locale : localizedLocaleMap.keySet()) { ArrayList entry = (ArrayList) localizedLocaleMap.get(locale); @@ -625,8 +625,8 @@ public class App extends ValueObject implements Comparable, Parcelable { * in the index JSON. */ private Map getLocalizedLocaleMap(Map> localized, - Set locales, String key) { - String[] localesToUse = getLocalesForKey(localized, locales, key); + Set supportedLocales, @NonNull String key) { + String[] localesToUse = getLocalesForKey(localized, supportedLocales, key); if (localesToUse.length > 0) { Locale firstMatch = systemLocaleList.getFirstMatch(localesToUse); if (firstMatch != null) { @@ -653,9 +653,9 @@ public class App extends ValueObject implements Comparable, Parcelable { * Get all locales that have an entry for {@code key}. */ private String[] getLocalesForKey(Map> localized, - Set locales, String key) { + Set supportedLocales, @NonNull String key) { Set localesToUse = new HashSet<>(); - for (String locale : locales) { + for (String locale : supportedLocales) { Map localeEntry = localized.get(locale); if (localeEntry != null && localeEntry.get(key) != null) { localesToUse.add(locale);