Skip to content

Commit

Permalink
chore(language): sort list by locale (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrie25 authored Nov 1, 2024
1 parent 36e6e05 commit 5fbfa5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private const val FARSI = 15
private const val GERMAN = 16
private const val THAI = 17
private const val JAPANESE = 18
private const val KOREAN = 19

val languages: Map<Int, String> =
mapOf(
Expand All @@ -58,8 +59,9 @@ val languages: Map<Int, String> =
Pair(FARSI, "fa"),
Pair(GERMAN, "de"),
Pair(THAI, "th"),
Pair(JAPANESE, "ja")
)
Pair(JAPANESE, "ja"),
Pair(KOREAN, "kr")
).toList().sortedBy { (_, value) -> value }.toMap()

fun getLanguageConfig(languageNumber: Int = Prefs[Prefs.LANGUAGE]): String {
return if (languages.containsKey(languageNumber)) languages[languageNumber].toString() else ""
Expand Down Expand Up @@ -102,6 +104,7 @@ fun getLanguageDesc(language: Int = getLanguageNumber()): String {
GERMAN -> R.string.locale_de
THAI -> R.string.locale_th
JAPANESE -> R.string.locale_ja
KOREAN -> R.string.locale_kr
else -> R.string.follow_system
}
)
Expand Down
2 changes: 1 addition & 1 deletion common/resources/src/main/res/values/translations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<string name="locale_fil" translatable="false">Filipino</string>
<string name="locale_fr" translatable="false">French</string>
<string name="locale_hr" translatable="false">Hrvatski</string>
<string name="locale_de" translatable="false">German</string>
<string name="locale_de" translatable="false">Deutsch</string>
<string name="locale_th" translatable="false">ภาษาไทย</string>
<string name="locale_fa" translatable="false">فارسی</string>
<string name="locale_es" translatable="false">Español</string>
Expand Down

0 comments on commit 5fbfa5c

Please sign in to comment.