Skip to content

Commit

Permalink
manager: allow to query language if country is unknown. close #1495
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Mar 21, 2024
1 parent e38a5e5 commit 3291538
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -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
}
Expand Down

0 comments on commit 3291538

Please sign in to comment.