Sort languages, add Hebrew

This commit is contained in:
arkon 2020-04-07 22:00:39 -04:00
parent 0f0305c602
commit be6a209fe9

View File

@ -53,14 +53,22 @@ class SettingsGeneralController : SettingsController() {
listPreference { listPreference {
key = Keys.lang key = Keys.lang
titleRes = R.string.pref_language titleRes = R.string.pref_language
entryValues = arrayOf("", "ar", "bg", "bn", "ca", "cs", "de", "el", "en-US", "en-GB",
"es", "fr", "hi", "hu", "in", "it", "ja", "ko", "lv", "ms", "nb-rNO", "nl", "pl", "pt", val langs = mutableListOf<Pair<String, String>>()
"pt-BR", "ro", "ru", "sc", "sr", "sv", "th", "tl", "tr", "uk", "vi", "zh-rCN") langs += Pair("", context.getString(R.string.system_default))
entries = entryValues.map { value -> langs += arrayOf(
val locale = LocaleHelper.getLocaleFromString(value.toString()) "ar", "bg", "bn", "ca", "cs", "de", "el", "en-US", "en-GB", "es", "fr", "he",
locale?.getDisplayName(locale)?.capitalize() "hi", "hu", "in", "it", "ja", "ko", "lv", "ms", "nb-rNO", "nl", "pl", "pt",
?: context.getString(R.string.system_default) "pt-BR", "ro", "ru", "sc", "sr", "sv", "th", "tl", "tr", "uk", "vi", "zh-rCN"
}.toTypedArray() )
.map {
val locale = LocaleHelper.getLocaleFromString(it)
Pair(it, locale!!.getDisplayName(locale).capitalize())
}
.sortedBy { it.second }
entryValues = langs.map { it.first }.toTypedArray()
entries = langs.map { it.second }.toTypedArray()
defaultValue = "" defaultValue = ""
summary = "%s" summary = "%s"