diff --git a/src/main/kotlin/main/Form.kt b/src/main/kotlin/main/Form.kt index 0d1e37b..cd1973b 100644 --- a/src/main/kotlin/main/Form.kt +++ b/src/main/kotlin/main/Form.kt @@ -164,6 +164,9 @@ fun formPage(onCancelClick: () -> Unit) { val wordsList = loadDatasFromFile().toMutableList() + // Transform name to lowercase to avoid duplicates + name.value = name.value.lowercase() + // Verify if the word already exists in the glossary if (wordsList.any { it.name.equals(name.value, ignoreCase = true) }) { println("Le mot '${name.value}' existe déjà dans le glossaire. Ajout annulé.")