mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
clean up language tags parser
This commit is contained in:
parent
c9ac6860db
commit
08ec7dfef1
1 changed files with 3 additions and 4 deletions
|
|
@ -51,16 +51,15 @@ object LanguageUtils : Logging {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
errormsg("Error parsing locale_config.xml ${e.message}")
|
errormsg("Error parsing locale_config.xml ${e.message}")
|
||||||
}
|
}
|
||||||
fun getDisplayLanguage(tag: String): String {
|
return languageTags.map { tag ->
|
||||||
val loc = Locale(tag)
|
val loc = Locale(tag)
|
||||||
return when (tag) {
|
when (tag) {
|
||||||
SYSTEM_DEFAULT -> context.getString(R.string.preferences_system_default)
|
SYSTEM_DEFAULT -> context.getString(R.string.preferences_system_default)
|
||||||
"fr-HT" -> context.getString(R.string.fr_HT)
|
"fr-HT" -> context.getString(R.string.fr_HT)
|
||||||
"pt-BR" -> context.getString(R.string.pt_BR)
|
"pt-BR" -> context.getString(R.string.pt_BR)
|
||||||
else -> loc.getDisplayLanguage(loc)
|
else -> loc.getDisplayLanguage(loc)
|
||||||
.replaceFirstChar { if (it.isLowerCase()) it.titlecase(loc) else it.toString() }
|
.replaceFirstChar { if (it.isLowerCase()) it.titlecase(loc) else it.toString() }
|
||||||
}
|
} to tag
|
||||||
}
|
}
|
||||||
return languageTags.map { getDisplayLanguage(it) to it }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue