title: How do I add args to custom i18n messages in grails?
body: <p>I have an object which I declared as "unique:true" and then I created a custom message in message.properties in grails. It appears correctly, but I don't know how to pass arguments to it. Is it even possible?</p>
  
  <pre><code>net.mypackage.MyObject.myField.unique = The Object {0} already belongs to the Object Group {1}.
  </code></pre>
  
  <p>I am aware that I can pass args via "g:message" but in this case I am rendering my errors via this snippet:</p>
  
  <pre><code>&lt;g:hasErrors bean="${object}"&gt;
                          &lt;ul class="errors no-margin" role="alert"&gt;
                              &lt;g:eachError bean="${object}" var="error"&gt;
                              &lt;li &lt;g:if test="${error in org.springframework.validation.FieldError}"&gt;data-field-id="${error.field}"&lt;/g:if&gt;&gt;&lt;g:message error="${error}"/&gt;&lt;/li&gt;
                              &lt;/g:eachError&gt;
                          &lt;/ul&gt;
                      &lt;/g:hasErrors&gt;
  </code></pre>
  
  <p>I can probably hack it like say do an if-else to determine if the error was a "unique constraint" error then pass the values, but other than that I don't have any idea. Most of the custom message examples I see on the internet are related to custom validators. I tried.. But I dont want to resort to that just yet... Any opinions on how to do this? </p>