manager: allow to query language if country is unknown. close #1495
This commit is contained in:
@@ -209,9 +209,14 @@ private fun getLocaleString(json: JSONObject, key: String): String {
|
||||
val locale = Locale.getDefault()
|
||||
val localeKey = "${locale.language}_${locale.country}"
|
||||
json.optJSONObject("locales")?.let {
|
||||
// check locale first
|
||||
it.optJSONObject(localeKey)?.let { json->
|
||||
return json.optString(key, fallback)
|
||||
}
|
||||
// fallback to language
|
||||
it.optJSONObject(locale.language)?.let { json->
|
||||
return json.optString(key, fallback)
|
||||
}
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user