Show definitions of cross-straits or moe in search results, if cedict definitions are not available

This commit is contained in:
Marvin Elsen 2024-10-10 22:26:22 +02:00
parent 898a5d3cc5
commit 33402c0fcb
Signed by: marvinelsen
GPG Key ID: 820672408CC318C2

View File

@ -110,9 +110,15 @@ internal class EntryCell(private val resources: ResourceBundle, private val conf
)
)
val definition = entry.cedictDefinitions.joinToString(
val definition = when {
entry.cedictDefinitions.isNotEmpty() -> entry.cedictDefinitions.joinToString(
separator = " / "
) { it.joinToString(separator = "; ") }
entry.crossStraitsDefinitions.isNotEmpty() -> entry.crossStraitsDefinitions.joinToString(separator = " / ") { it.definition }
entry.moedictDefinitions.isNotEmpty() -> entry.moedictDefinitions.joinToString(separator = " / ") { it.definition }
else -> error("No definition for entry")
}
labelDefinition.text = definition
contextMenu = createContextMenuForEntry(entry, resources)