mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 20:31:02 -05:00
Explicitly reword some locale names
Avoiding some country names in favour of more generic terminology where appropriate.
This commit is contained in:
parent
6be9cccc7a
commit
0ca14c61c2
1 changed files with 7 additions and 6 deletions
|
@ -12,7 +12,7 @@ import java.util.Locale
|
||||||
object LocaleHelper {
|
object LocaleHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Display name of a string language code
|
* Returns display name of a string language code.
|
||||||
*/
|
*/
|
||||||
fun getSourceDisplayName(lang: String?, context: Context): String {
|
fun getSourceDisplayName(lang: String?, context: Context): String {
|
||||||
return when (lang) {
|
return when (lang) {
|
||||||
|
@ -25,7 +25,7 @@ object LocaleHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Display name of a string language code
|
* Returns display name of a string language code.
|
||||||
*
|
*
|
||||||
* @param lang empty for system language
|
* @param lang empty for system language
|
||||||
*/
|
*/
|
||||||
|
@ -34,10 +34,11 @@ object LocaleHelper {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
val locale = if (lang.isEmpty()) {
|
val locale = when {
|
||||||
LocaleListCompat.getAdjustedDefault()[0]
|
lang.isEmpty() -> LocaleListCompat.getAdjustedDefault()[0]
|
||||||
} else {
|
lang == "zh-CN" -> Locale.forLanguageTag("zh-Hans")
|
||||||
Locale.forLanguageTag(lang)
|
lang == "zh-TW" -> Locale.forLanguageTag("zh-Hant")
|
||||||
|
else -> Locale.forLanguageTag(lang)
|
||||||
}
|
}
|
||||||
return locale!!.getDisplayName(locale).replaceFirstChar { it.uppercase(locale) }
|
return locale!!.getDisplayName(locale).replaceFirstChar { it.uppercase(locale) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue