You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martijn Hinten <ma...@cumquat.nl> on 2006/05/19 13:13:06 UTC

How to use my own ValidationStrings.properties?

Er... This list still for tech geeks, or graphical artists?

Hold your horses, just joking. ;-)

But I do have a question: What is the preferred way of overriding Tap's 
ValidationStrings.properties? I could not find any configuration 
setting, so I sort of have overriden Howards 'getPattern() method in 
BaseValidator, like the code below. I call my 
getMessageFromValidationStrings from within my validator's 
buildMessages() method. Is that a good way to use my own ValidationStrings?

Thanks for any reply,
Martijn

  /** Copied from HLS's getPattern
   *
   * TODO document me more
   *
   * @param override
   * @param key
   * @param locale
   * @return
   */
    protected String getMessageFromValidationStrings(String key, Locale 
locale)  {
   
    try {
      ResourceBundle strings =
        ResourceBundle.getBundle("my.package.ValidationStrings", locale);

      return strings.getString(key);
    } catch ( java.util.MissingResourceException e ) {
      return ("["+key+"]").toUpperCase();
    }
  } 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org