|
|
@ -23,10 +23,14 @@ class LocaleViewHolder(
|
|
|
|
if (locale.toString().equals("vec", ignoreCase = true)) {
|
|
|
|
if (locale.toString().equals("vec", ignoreCase = true)) {
|
|
|
|
locale.toString()
|
|
|
|
locale.toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Capitalisation is done using the rules of the appropriate locale (endonym and exonym).
|
|
|
|
if (locale.language == "zh") {
|
|
|
|
locale_title_text.text = getDisplayName(locale)
|
|
|
|
bindChineseLocale(locale)
|
|
|
|
// Show the given locale using the device locale for the subtitle.
|
|
|
|
} else {
|
|
|
|
locale_subtitle_text.text = locale.getProperDisplayName()
|
|
|
|
// Capitalisation is done using the rules of the appropriate locale (endonym and exonym).
|
|
|
|
|
|
|
|
locale_title_text.text = getDisplayName(locale)
|
|
|
|
|
|
|
|
// Show the given locale using the device locale for the subtitle.
|
|
|
|
|
|
|
|
locale_subtitle_text.text = locale.getProperDisplayName()
|
|
|
|
|
|
|
|
}
|
|
|
|
locale_selected_icon.isVisible = isCurrentLocaleSelected(locale, isDefault = false)
|
|
|
|
locale_selected_icon.isVisible = isCurrentLocaleSelected(locale, isDefault = false)
|
|
|
|
|
|
|
|
|
|
|
|
itemView.setOnClickListener {
|
|
|
|
itemView.setOnClickListener {
|
|
|
@ -34,6 +38,20 @@ class LocaleViewHolder(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun bindChineseLocale(locale: Locale) {
|
|
|
|
|
|
|
|
if (locale.country == "CN") {
|
|
|
|
|
|
|
|
locale_title_text.text =
|
|
|
|
|
|
|
|
Locale.forLanguageTag("zh-Hans").getDisplayName(locale).capitalize(locale)
|
|
|
|
|
|
|
|
locale_subtitle_text.text =
|
|
|
|
|
|
|
|
Locale.forLanguageTag("zh-Hans").displayName.capitalize(Locale.getDefault())
|
|
|
|
|
|
|
|
} else if (locale.country == "TW") {
|
|
|
|
|
|
|
|
locale_title_text.text =
|
|
|
|
|
|
|
|
Locale.forLanguageTag("zh-Hant").getDisplayName(locale).capitalize(locale)
|
|
|
|
|
|
|
|
locale_subtitle_text.text =
|
|
|
|
|
|
|
|
Locale.forLanguageTag("zh-Hant").displayName.capitalize(Locale.getDefault())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun getDisplayName(locale: Locale): String {
|
|
|
|
private fun getDisplayName(locale: Locale): String {
|
|
|
|
val displayName = locale.getDisplayName(locale).capitalize(locale)
|
|
|
|
val displayName = locale.getDisplayName(locale).capitalize(locale)
|
|
|
|
if (displayName.equals(locale.toString(), ignoreCase = true)) {
|
|
|
|
if (displayName.equals(locale.toString(), ignoreCase = true)) {
|
|
|
@ -255,8 +273,16 @@ class SystemLocaleViewHolder(
|
|
|
|
|
|
|
|
|
|
|
|
override fun bind(locale: Locale) {
|
|
|
|
override fun bind(locale: Locale) {
|
|
|
|
locale_title_text.text = itemView.context.getString(R.string.default_locale_text)
|
|
|
|
locale_title_text.text = itemView.context.getString(R.string.default_locale_text)
|
|
|
|
// Use the device locale for the system locale subtitle.
|
|
|
|
if (locale.script == "Hant") {
|
|
|
|
locale_subtitle_text.text = locale.getDisplayName(locale).capitalize(locale)
|
|
|
|
locale_subtitle_text.text =
|
|
|
|
|
|
|
|
Locale.forLanguageTag("zh-Hant").displayName.capitalize(Locale.getDefault())
|
|
|
|
|
|
|
|
} else if (locale.script == "Hans") {
|
|
|
|
|
|
|
|
locale_subtitle_text.text =
|
|
|
|
|
|
|
|
Locale.forLanguageTag("zh-Hans").displayName.capitalize(Locale.getDefault())
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Use the device locale for the system locale subtitle.
|
|
|
|
|
|
|
|
locale_subtitle_text.text = locale.getDisplayName(locale).capitalize(locale)
|
|
|
|
|
|
|
|
}
|
|
|
|
locale_selected_icon.isVisible = isCurrentLocaleSelected(locale, isDefault = true)
|
|
|
|
locale_selected_icon.isVisible = isCurrentLocaleSelected(locale, isDefault = true)
|
|
|
|
itemView.setOnClickListener {
|
|
|
|
itemView.setOnClickListener {
|
|
|
|
interactor.onDefaultLocaleSelected()
|
|
|
|
interactor.onDefaultLocaleSelected()
|
|
|
|