Add a option for Chinese(Traditional) translation and fix the option for Indonesian translation

This commit is contained in:
Ash 2022-08-08 11:59:07 +08:00
parent f695a2a040
commit 4d6e36dc6b
3 changed files with 15 additions and 7 deletions

View File

@ -26,6 +26,8 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
object Basque : LanguagesPreference(11) object Basque : LanguagesPreference(11)
object Indonesian : LanguagesPreference(12) object Indonesian : LanguagesPreference(12)
object ChineseTraditional : LanguagesPreference(13)
override fun put(context: Context, scope: CoroutineScope) { override fun put(context: Context, scope: CoroutineScope) {
scope.launch { scope.launch {
context.dataStore.put( context.dataStore.put(
@ -51,6 +53,7 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
Russian -> context.getString(R.string.russian) Russian -> context.getString(R.string.russian)
Basque -> context.getString(R.string.basque) Basque -> context.getString(R.string.basque)
Indonesian -> context.getString(R.string.indonesian) Indonesian -> context.getString(R.string.indonesian)
ChineseTraditional -> context.getString(R.string.chinese_traditional)
} }
fun getLocale(): Locale = fun getLocale(): Locale =
@ -67,7 +70,8 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
Polish -> Locale("pl", "PL") Polish -> Locale("pl", "PL")
Russian -> Locale("ru", "RU") Russian -> Locale("ru", "RU")
Basque -> Locale("eu", "EU") Basque -> Locale("eu", "EU")
Indonesian -> Locale("id", "ID") Indonesian -> Locale("in", "ID")
ChineseTraditional -> Locale("zh", "TW")
} }
fun setLocale(context: Context) { fun setLocale(context: Context) {
@ -105,6 +109,7 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
Russian, Russian,
Basque, Basque,
Indonesian, Indonesian,
ChineseTraditional,
) )
fun fromPreferences(preferences: Preferences): LanguagesPreference = fun fromPreferences(preferences: Preferences): LanguagesPreference =
@ -122,6 +127,7 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
10 -> Russian 10 -> Russian
11 -> Basque 11 -> Basque
12 -> Indonesian 12 -> Indonesian
13 -> ChineseTraditional
else -> default else -> default
} }
@ -140,6 +146,7 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
10 -> Russian 10 -> Russian
11 -> Basque 11 -> Basque
12 -> Indonesian 12 -> Indonesian
13 -> ChineseTraditional
else -> default else -> default
} }
} }

View File

@ -115,6 +115,7 @@
<string name="russian" translatable="false">Русский</string> <string name="russian" translatable="false">Русский</string>
<string name="basque" translatable="false">Euskara</string> <string name="basque" translatable="false">Euskara</string>
<string name="indonesian" translatable="false">Bahasa Indonesia</string> <string name="indonesian" translatable="false">Bahasa Indonesia</string>
<string name="chinese_traditional" translatable="false">繁體中文</string>
<string name="tips_and_support">Tips &amp; support</string> <string name="tips_and_support">Tips &amp; support</string>
<string name="tips_and_support_desc">About, open source licenses</string> <string name="tips_and_support_desc">About, open source licenses</string>
<string name="welcome">Welcome</string> <string name="welcome">Welcome</string>