I am researching the spelled-out function of icu4j 1.3.1, when I debuging my
program, i just wanna "23" be spelled out in chinese just as "¶þÈý" when the
locale is CHINA, but i can not see the chinese words, only the words same as the
Locale is US as"twenty three", why i can't see chinese words when Locale is
CHINA?
below is my program, maybe u can have a look and check it for me, or maybe u can
tell me where to find some sample programs, thanks a lot!
import com.ibm.text.*;
import com.ibm.text.NumberFormat;
import com.ibm.util.*;
import java.util.Locale;
public class NumberSpellOut {
public static void main(String args[]) {
try {
//Locale lc = Locale.getDefault();
String language = args[0];
String country = args[1];
Locale lc = new Locale(language, country);
String lg = lc.getDisplayLanguage();
System.out.println(lg);
String co = lc.getDisplayCountry();
System.out.println(co);
//com.ibm.text.NumberFormat nf = com.ibm.text.NumberFormat.getInstance(lc);
//com.ibm.text.NumberFormat nf =
com.ibm.text.NumberFormat.getNumberInstance(Locale.CHINESE);
com.ibm.text.RuleBasedNumberFormat rbnf =
new com.ibm.text.RuleBasedNumberFormat(lc, RuleBasedNumberFormat.SPELLOUT);
//1---SPELLOUT, 2---ORDINAL, 3---DURATION
int num1 = 12;
String numberMessage1 = rbnf.format(num1);
System.out.println(numberMessage1);
float num2 = 23467.234F;
String numberMessage2 = rbnf.format(num2);
System.out.println(numberMessage2);
com.ibm.util.Calendar cal = new GregorianCalendar(lc);
int style = DateFormat.LONG;
com.ibm.text.DateFormat df = DateFormat.getDateInstance(cal, style, lc);
com.ibm.text.DateFormat tf = DateFormat.getTimeInstance(cal, style, lc);
String dateMessage = df.format(cal.getTime());
String timeMessage = tf.format(cal.getTime());
System.out.println(dateMessage);
System.out.println(timeMessage);
System.out.println(com.ibm.text.Transliterator.getDisplayName("AB-B", lc));
//for (int i=0;rbnf.getRuleSetNames();i++) {
System.out.println(rbnf.getRuleSetNames()[0]);
System.out.println(rbnf.getRuleSetNames()[1]);
//}
} catch (Exception e) {
}
}
}
when i using java NumberSpellOut zh CN, i only can see words spelled out in
English, not in Chinese, and i can see correct russian words using "java
NumberSpellOut ru RU" and same as france, japanese words, can u just tell me the
reason?