From 7f5e2602318451d793cc216cfe1fda369576c521 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 22 Sep 2015 11:41:51 +0200 Subject: [PATCH] =?utf8?q?Added=20own=20resource=20bundles=20+=20some=20fi?= =?utf8?q?xes=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jcoreee/validator/BaseObjectValidator.java | 6 +++--- .../validator/string/BaseStringValidator.java | 4 ++-- .../localization/bundle_de_DE.properties | 17 +++++++++++++++++ .../localization/bundle_en_US.properties | 17 +++++++++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 src/org/mxchange/localization/bundle_de_DE.properties create mode 100644 src/org/mxchange/localization/bundle_en_US.properties diff --git a/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java b/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java index 5d95ce4..308a82e 100644 --- a/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java +++ b/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java @@ -69,7 +69,7 @@ public abstract class BaseObjectValidator extends BaseEeSystem implements Valida // Init message and key FacesMessage facesMessage = null; - String errKey = "error.unknown_id"; //NOI18N + String errKey = "ERROR_UNKNOWN_ID"; //NOI18N // Get client id final String clientId = component.getClientId(); @@ -93,7 +93,7 @@ public abstract class BaseObjectValidator extends BaseEeSystem implements Valida errKey = String.format("ERROR_%s_IS_NULL", field.toUpperCase()); //NOI18N // Value it null - facesMessage = new FacesMessage(getMessageStringFromKey(errKey)); + facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey)); } // Abort here @@ -106,7 +106,7 @@ public abstract class BaseObjectValidator extends BaseEeSystem implements Valida // Valid field? if (!isValidField) { // Invalid field - facesMessage = new FacesMessage(MessageFormat.format(errKey, clientId)); + facesMessage = new FacesMessage(MessageFormat.format(this.getMessageStringFromKey(errKey), clientId)); } // Debug message diff --git a/src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java b/src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java index d64f5b5..c104de5 100644 --- a/src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java +++ b/src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java @@ -59,7 +59,7 @@ public abstract class BaseStringValidator extends BaseObjectValidator { // Value is empty errKey = String.format("ERROR_%s_IS_NOT_STRING", field.toUpperCase()); //NOI18N - facesMessage = new FacesMessage(getMessageStringFromKey(errKey)); + facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey)); } // Cast to string @@ -70,7 +70,7 @@ public abstract class BaseStringValidator extends BaseObjectValidator { // Value is empty errKey = String.format("ERROR_%s_IS_EMPTY", field.toUpperCase()); //NOI18N - facesMessage = new FacesMessage(getMessageStringFromKey(errKey)); + facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey)); } } } diff --git a/src/org/mxchange/localization/bundle_de_DE.properties b/src/org/mxchange/localization/bundle_de_DE.properties new file mode 100644 index 0000000..9f2ac26 --- /dev/null +++ b/src/org/mxchange/localization/bundle_de_DE.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2015 Roland Haeder +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +ERROR_AMOUNT_IS_NULL=Die Bestellmenge ist nicht gesetzt. +ERROR_AMOUNT_IS_NOT_LONG=Die eingegebene Menge ist keine Zahl. diff --git a/src/org/mxchange/localization/bundle_en_US.properties b/src/org/mxchange/localization/bundle_en_US.properties new file mode 100644 index 0000000..be963e3 --- /dev/null +++ b/src/org/mxchange/localization/bundle_en_US.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2015 Roland Haeder + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +ERROR_AMOUNT_IS_NULL=Order amount is not set. +ERROR_AMOUNT_IS_NOT_LONG=The entered amount is not a number. -- 2.39.5