Esempio n. 1
0
 /** Returns the form errors serialized as Json using the given Lang. */
 public org.codehaus.jackson.JsonNode errorsAsJson(play.i18n.Lang lang) {
   Map<String, List<String>> allMessages = new HashMap<String, List<String>>();
   for (String key : errors.keySet()) {
     List<ValidationError> errs = errors.get(key);
     if (errs != null && !errs.isEmpty()) {
       List<String> messages = new ArrayList<String>();
       for (ValidationError error : errs) {
         messages.add(play.i18n.Messages.get(lang, error.message(), error.arguments()));
       }
       allMessages.put(key, messages);
     }
   }
   return play.libs.Json.toJson(allMessages);
 }
 protected String _msg(String key, Object... params) {
   return play.i18n.Messages.get(key, params);
 }