diff --git a/src/main/java/ninja/javafx/smartcsv/validation/Validator.java b/src/main/java/ninja/javafx/smartcsv/validation/Validator.java index f462249..66182e9 100644 --- a/src/main/java/ninja/javafx/smartcsv/validation/Validator.java +++ b/src/main/java/ninja/javafx/smartcsv/validation/Validator.java @@ -151,7 +151,7 @@ public class Validator { private void checkBlankOrNull(Config columnConfig, String value, List result) { if (getBoolean(columnConfig, "not empty")) { if (isBlankOrNull(value)) { - result.add("should not be empty"); + result.add("validation.message.not.empty"); } } } @@ -159,7 +159,7 @@ public class Validator { private void checkInteger(Config columnConfig, String value, List result) { if (getBoolean(columnConfig, "integer")) { if (!isInt(value)) { - result.add("should be an integer"); + result.add("validation.message.integer"); } } } @@ -194,7 +194,7 @@ public class Validator { private void checkAlphaNumeric(Config columnConfig, String value, List result) { if (getBoolean(columnConfig, "alphanumeric")) { if (!matchRegexp(value, "[0-9a-zA-Z]*")) { - result.add("should not be alphanumeric"); + result.add("validation.message.alphanumeric"); } } } diff --git a/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv.properties b/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv.properties index 3ae4dc6..2ee4e0c 100644 --- a/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv.properties +++ b/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv.properties @@ -7,4 +7,9 @@ menu.about = About menu.file = File menu.edit = Edit menu.help = Help -title.validation.errors = Validation Errors: \ No newline at end of file +title.validation.errors = Validation Errors: + +# validaton messages +validation.message.not.empty = should not be empty +validation.message.integer = should be an integer +validation.message.alphanumeric = should be alphanumeric \ No newline at end of file diff --git a/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv_de.properties b/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv_de.properties index 889e48d..0da38ec 100644 --- a/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv_de.properties +++ b/src/main/resources/ninja/javafx/smartcsv/fx/smartcsv_de.properties @@ -15,4 +15,9 @@ menu.about = \u00dcber ... menu.file = Datei menu.edit = Bearbeiten menu.help = Hilfe -title.validation.errors = Fehler in der Datei: \ No newline at end of file +title.validation.errors = Fehler in der Datei: + +# validaton messages +validation.message.not.empty = Darf nicht leer sein. +validation.message.integer = Muss eine Zahl sein. +validation.message.alphanumeric = Darf nur Zahlen und Buchstaben enthalten. \ No newline at end of file diff --git a/src/test/java/ninja/javafx/smartcsv/validation/ValidatorTest.java b/src/test/java/ninja/javafx/smartcsv/validation/ValidatorTest.java index b8c537d..f7a14d0 100644 --- a/src/test/java/ninja/javafx/smartcsv/validation/ValidatorTest.java +++ b/src/test/java/ninja/javafx/smartcsv/validation/ValidatorTest.java @@ -85,10 +85,10 @@ public class ValidatorTest { public static Collection validationConfigurations() { return asList(new Object[][] { { "column", "not empty", true, "column", "value", true, null }, - { "column", "not empty", true, "column", "", false, "should not be empty" }, - { "column", "not empty", true, "column", null, false, "should not be empty" }, + { "column", "not empty", true, "column", "", false, "validation.message.not.empty" }, + { "column", "not empty", true, "column", null, false, "validation.message.not.empty" }, { "column", "integer", true, "column", "999", true, null }, - { "column", "integer", true, "column", "a", false, "should be an integer" }, + { "column", "integer", true, "column", "a", false, "validation.message.integer" }, { "column", "minlength", 2, "column", "12", true, null }, { "column", "minlength", 2, "column", "1", false, "has not min length of 2" }, { "column", "maxlength", 2, "column", "12", true, null }, @@ -96,7 +96,7 @@ public class ValidatorTest { { "column", "date", "yyyyMMdd", "column", "20151127", true, null }, { "column", "date", "yyyyMMdd", "column", "27.11.2015", false, "is not a date of format yyyyMMdd" }, { "column", "alphanumeric", true, "column", "abcABC123", true, null }, - { "column", "alphanumeric", true, "column", "-abcABC123", false, "should not be alphanumeric" }, + { "column", "alphanumeric", true, "column", "-abcABC123", false, "validation.message.alphanumeric" }, { "column", "regexp", "[a-z]*", "column", "abc", true, null }, { "column", "regexp", "[a-z]*", "column", "abcA", false, "does not match [a-z]*" }, { "column", "groovy", "value.contains('a')? 'true' : 'no a inside'", "column", "abcdef", true, null },