mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 13:18:56 +07:00
Sort Civilopedia entries using locale (#4560)
This commit is contained in:
@ -11,6 +11,7 @@ import com.unciv.models.ruleset.VictoryType
|
|||||||
import com.unciv.models.stats.INamed
|
import com.unciv.models.stats.INamed
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
|
import java.text.Collator
|
||||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||||
|
|
||||||
/** Screen displaying the Civilopedia
|
/** Screen displaying the Civilopedia
|
||||||
@ -97,7 +98,9 @@ class CivilopediaScreen(
|
|||||||
if (category !in categoryToEntries) return // defense, allowing buggy panes to remain empty while others work
|
if (category !in categoryToEntries) return // defense, allowing buggy panes to remain empty while others work
|
||||||
var entries = categoryToEntries[category]!!
|
var entries = categoryToEntries[category]!!
|
||||||
if (category != CivilopediaCategories.Difficulty) // this is the only case where we need them in order
|
if (category != CivilopediaCategories.Difficulty) // this is the only case where we need them in order
|
||||||
entries = entries.sortedBy { it.name.tr() } // Alphabetical order of localized names
|
// Alphabetical order of localized names, using system default locale
|
||||||
|
entries = entries.sortedWith(compareBy(Collator.getInstance(), { it.name.tr() }))
|
||||||
|
|
||||||
var currentY = -1f
|
var currentY = -1f
|
||||||
|
|
||||||
for (entry in entries) {
|
for (entry in entries) {
|
||||||
|
Reference in New Issue
Block a user