1 15 package org.apache.tapestry.form; 16 17 import java.text.MessageFormat ; 18 import java.util.Locale ; 19 20 import org.apache.hivemind.util.Defense; 21 import org.apache.tapestry.valid.ValidationStrings; 22 23 31 public class ValidationMessagesImpl implements ValidationMessages 32 { 33 private Locale _locale; 34 35 public ValidationMessagesImpl(Locale locale) 36 { 37 Defense.notNull(locale, "locale"); 38 39 _locale = locale; 40 } 41 42 public String formatValidationMessage(String messageOverride, String messageKey, 43 Object [] arguments) 44 { 45 String message = (messageOverride == null) ? ValidationStrings.getMessagePattern( 46 messageKey, 47 _locale) : messageOverride; 48 49 return MessageFormat.format(message, arguments); 50 } 51 52 } 53 | Popular Tags |