title: How to "effectively" set default error messages of sfValidatorInteger etc.?
body: <p>I just rumbled into a problem that I assume to be some kind of 'bug' of the symfony framework: I want to set default error messages for different types of validators (e.g. <code>sfValidatorInteger</code>). For this, inside of my <code>ProjectConfiguration::setup</code> method, I have:</p>
  
  <pre><code>sfValidatorBase::setDefaultMessage('required', 'Erforderlich.');
  sfValidatorBase::setDefaultMessage('invalid', 'Format ungültig.');
  sfValidatorInteger::setDefaultMessage('invalid', '"%value%" ist keine Ganzzahl.');
  </code></pre>
  
  <p>This works fine for <code>sfValidatorBase</code> but not for, for example, <code>sfValidatorInteger</code>. <code>sfValidatorInteger</code> still shows the preset default message <code>'"%value% is not an integer.'</code>.</p>
  
  <p>So, I had a look at the implementation of <code>sfValidatorInteger::configure</code> and figured out that it sets the instance's error messages hard-coded:</p>
  
  <pre><code>protected function configure($options = array(), $messages = array())
  {
    $this-&gt;addMessage('max', '"%value%" must be at most %max%.');
    $this-&gt;addMessage('min', '"%value%" must be at least %min%.');
  
    $this-&gt;addOption('min');
    $this-&gt;addOption('max');
  
    $this-&gt;setMessage('invalid', '"%value%" is not an integer.');
  }
  </code></pre>
  
  <p>I'd have expected that the error messages are read from the default message map but, obviously, they are not.</p>
  
  <p>So, how could I solve this problem in a clean way preferably without touching the original symfony code (as my changes could be overwritten during future updates)? Should I derive all the validator classes to provide an appropriate <code>configure</code> implementation? Well, I don't think so. Setting the error messages for each validator instance separately would also be no (clean) option.</p>
  
  <p>Maybe I got something wrong concerning the configuration of them validators. Then, a more general question would be: How to set default error messages for different validator classes like <code>'invalid' =&gt; '"%value%" ist keine Ganzzahl.'</code> for <code>sfValidatorInteger</code>?</p>
  
  <p>Thanks in advance,<br>
  Flinsch.</p>