title: How to get the ordinal suffix of a number for many languages in Java or Groovy
body: <p>I am building a multi-languages <strong>grails</strong> website and I need to get the <strong>ordinal suffix of a number for several languages</strong> like English, French, Spanish, German and Italian.</p>
  
  <p>I believe that this issue is quite common for multi-languages website owners. I have found <a href="http://www.javalobby.org/forums/thread.jspa?threadID=16906&amp;tstart=0" rel="noreferrer">this article</a> that provides a solution but it is English only. </p>
  
  <p>For instance:</p>
  
  <pre><code>/**
   *@value number 
   *@locale Current locale
   *@returns ordinal suffix for the given number
  **/
  public static String getOrdinalFor(int value, Locale locale) 
  </code></pre>
  
  <p>will give the following results:</p>
  
  <pre><code> assert getOrdinalFor(1, Locale.ENGLISH) == "st"
   assert getOrdinalFor(1, Locale.FRENCH) == "er"
   assert getOrdinalFor(2, Locale.ENGLISH) == "nd"
   assert getOrdinalFor(3, Locale.ENGLISH) == "rd"
   assert getOrdinalFor(4, Locale.ENGLISH) == "th"
   assert getOrdinalFor(4, Locale.FRENCH) == "ème"
  </code></pre>
  
  <p>Do you know a library (in Java or Groovy) that can help this? Or do you know an algorithm that implements it?</p>