mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-30 19:54:27 -04:00
clean up language tags parser
This commit is contained in:
@@ -51,16 +51,15 @@ object LanguageUtils : Logging {
|
||||
} catch (e: Exception) {
|
||||
errormsg("Error parsing locale_config.xml ${e.message}")
|
||||
}
|
||||
fun getDisplayLanguage(tag: String): String {
|
||||
return languageTags.map { tag ->
|
||||
val loc = Locale(tag)
|
||||
return when (tag) {
|
||||
when (tag) {
|
||||
SYSTEM_DEFAULT -> context.getString(R.string.preferences_system_default)
|
||||
"fr-HT" -> context.getString(R.string.fr_HT)
|
||||
"pt-BR" -> context.getString(R.string.pt_BR)
|
||||
else -> loc.getDisplayLanguage(loc)
|
||||
.replaceFirstChar { if (it.isLowerCase()) it.titlecase(loc) else it.toString() }
|
||||
}
|
||||
} to tag
|
||||
}
|
||||
return languageTags.map { getDisplayLanguage(it) to it }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user