Hardcode unsupported native language names

This commit is contained in:
goapunk
2018-11-02 13:50:38 +01:00
committed by akwizgran
parent 8e0b71c76f
commit c247e3aa4e

View File

@@ -300,13 +300,21 @@ public class SettingsFragment extends PreferenceFragmentCompat
LOG.info("Skipping unsupported locale " + tag); LOG.info("Skipping unsupported locale " + tag);
continue; continue;
} }
String nativeName = locale.getDisplayName(locale); String nativeName;
// Fallback to English if the name is unknown in both native and // Unsupported languages won't be translated to their native name.
// current locale. if (locale.getLanguage().equals("ast")) {
if (nativeName.equals(tag)) { nativeName = "Asturianu";
String tmp = locale.getDisplayLanguage(Locale.ENGLISH); } else if (locale.getLanguage().equals("oc")) {
if (!tmp.isEmpty() && !tmp.equals(nativeName)) nativeName = "Occitan";
nativeName = tmp; } else {
nativeName = locale.getDisplayName(locale);
// Fallback to English if the name is unknown in both native and
// current locale.
if (nativeName.equals(tag)) {
String tmp = locale.getDisplayLanguage(Locale.ENGLISH);
if (!tmp.isEmpty() && !tmp.equals(nativeName))
nativeName = tmp;
}
} }
// Prefix with LRM marker to prevent any RTL direction // Prefix with LRM marker to prevent any RTL direction
entries.add("\u200E" + nativeName.substring(0, 1).toUpperCase() entries.add("\u200E" + nativeName.substring(0, 1).toUpperCase()