Skip to content

Commit

Permalink
Improved error messages and added localization.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmrsulja authored and litvinovg committed Dec 11, 2023
1 parent 83c553b commit 9156eba
Show file tree
Hide file tree
Showing 9 changed files with 328 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Expand Down Expand Up @@ -325,21 +327,22 @@ private String nonNullAndTrim(HttpServletRequest req, String key) {

private String validateInput(String webusername, String webuseremail,
String comments, String captchaInput, String challengeId, VitroRequest vreq) {
I18nBundle i18nBundle = I18n.bundle(vreq);

if (webusername.isEmpty()) {
return "Please enter a value in the Full name field.";
return i18nBundle.text("full_name_empty");
}

if (webuseremail.isEmpty()) {
return "Please enter a valid email address.";
return i18nBundle.text("email_address_empty");
}

if (comments.isEmpty()) {
return "Please enter your comments or questions in the space provided.";
return i18nBundle.text("comments_empty");
}

if (captchaInput.isEmpty()) {
return "Please enter the contents of the gray box in the security field provided.";
return i18nBundle.text("captcha_user_sol_empty");
}

switch(captchaImpl) {
Expand All @@ -356,7 +359,7 @@ private String validateInput(String webusername, String webuseremail,
}


return "The value you entered in the security field did not match the letters displayed in the gray box.";
return i18nBundle.text("captcha_user_sol_invalid");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Bitte geben Sie einen Wert im Feld Vollständiger Name ein."@de-DE ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Bitte geben Sie eine gültige E-Mail-Adresse ein."@de-DE ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Bitte geben Sie Ihre Kommentare oder Fragen in das bereitgestellte Feld ein."@de-DE ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Bitte lösen Sie die CAPTCHA-Herausforderung im bereitgestellten Sicherheitsfeld."@de-DE ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Ungültige CAPTCHA-Lösung, bitte versuchen Sie es erneut."@de-DE ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please enter a value in the Full name field."@en-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please enter a valid email address."@en-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please enter your comments or questions in the space provided."@en-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please solve CAPTCHA challenge in the security field provided."@en-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Invalid CAPTCHA solution, please try again."@en-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please enter a value in the Full name field."@en-US ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please enter a valid email address."@en-US ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please enter your comments or questions in the space provided."@en-US ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please solve CAPTCHA challenge in the security field provided."@en-US ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Invalid CAPTCHA solution, please try again."@en-US ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, ingrese un valor en el campo de nombre completo."@es ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, ingrese una dirección de correo electrónico válida."@es ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, ingrese sus comentarios o preguntas en el espacio proporcionado."@es ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, resuelva el desafío CAPTCHA en el campo de seguridad proporcionado."@es ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Solución CAPTCHA no válida, por favor, inténtelo nuevamente."@es ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Veuillez entrer une valeur dans le champ du nom complet."@fr-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Veuillez entrer une adresse e-mail valide."@fr-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Veuillez entrer vos commentaires ou questions dans l'espace prévu."@fr-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Veuillez résoudre le défi CAPTCHA dans le champ de sécurité fourni."@fr-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Solution CAPTCHA invalide, veuillez réessayer."@fr-CA ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, insira um valor no campo de nome completo."@pt-BR ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, insira um endereço de e-mail válido."@pt-BR ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, insira seus comentários ou perguntas no espaço fornecido."@pt-BR ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Por favor, resolva o desafio CAPTCHA no campo de segurança fornecido."@pt-BR ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Solução CAPTCHA inválida, por favor, tente novamente."@pt-BR ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Пожалуйста, введите значение в поле ФИО."@ru-RU ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Пожалуйста, введите действительный адрес электронной почты."@ru-RU ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Пожалуйста, введите свои комментарии или вопросы в предоставленное поле."@ru-RU ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Пожалуйста, решите задачу CAPTCHA в предоставленном поле безопасности."@ru-RU ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Недопустимое решение CAPTCHA, пожалуйста, попробуйте снова."@ru-RU ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .
Original file line number Diff line number Diff line change
Expand Up @@ -6269,3 +6269,43 @@ uil-data:no_individual_associated_with_id.Vitro
uil:hasApp "Vitro" ;
uil:hasKey "no_individual_associated_with_id" ;
uil:hasPackage "Vitro-languages" .

uil-data:full_name_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Molimo vas da unesete vrednost u polje za puno ime."@sr-Latn-RS ;
uil:hasApp "Vitro" ;
uil:hasKey "full_name_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:email_address_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Molimo vas da unesete ispravnu email adresu."@sr-Latn-RS ;
uil:hasApp "Vitro" ;
uil:hasKey "email_address_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:comments_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Molimo vas da unesete vaše komentare ili pitanja u predviđeno polje."@sr-Latn-RS ;
uil:hasApp "Vitro" ;
uil:hasKey "comments_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_empty.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Molimo vas da rešite CAPTCHA izazov u predviđenom sigurnosnom polju."@sr-Latn-RS ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_empty" ;
uil:hasPackage "Vitro-languages" .

uil-data:captcha_user_sol_invalid.Vitro
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Pogrešno rešenje CAPTCHA izazova, molimo vas da pokušate ponovo."@sr-Latn-RS ;
uil:hasApp "Vitro" ;
uil:hasKey "captcha_user_sol_invalid" ;
uil:hasPackage "Vitro-languages" .

0 comments on commit 9156eba

Please sign in to comment.