You want to spell out a dynamic numeric value being combined with a static resource.
Java MessageFormat provides a number of options for formatting the values passed in. ICU4J provides even more options.
One of the more interesting formatting options is the spellout format. Spell out will actually write out a numeric value, such as thirty-five vs. 35.
ICU4J's MessageFormat is used similar to the code Java class.
To format a pattern using a spellout pattern:
//Create an Array of Objects
Object[] tmp = {345};
//Create our pattern. We specify that we will replace using the first element in the array
//and use a spellout pattern
String msg = "I have {0,spellout} coffee cups in my car.";
//Retrieve the MessageFormat
MessageFormat mf = new MessageFormat(msg,ULocale.ENGLISH);
//Call format passing in the array
System.out.println(mf.format(tmp));
//Now lets do it in Japanese
String jMsg = "私の車の中に{0,spellout}個のコーヒーカップがあります。";
MessageFormat mf2 = new MessageFormat(jMsg,ULocale.JAPANESE);
System.out.println(mf2.format(tmp));
The output is:
I have three hundred and forty-five coffee cups in my car.
私の車の中に三百四十五個のコーヒーカップがあります。