use of android.icu.text.DateFormatSymbols in project j2objc by google.
the class IntlTestDateFormatSymbols method TestConstructorWithCalendar.
@Test
public void TestConstructorWithCalendar() {
ULocale[] TestLocales = { new ULocale("en_US@calendar=gregorian"), new ULocale("ja_JP@calendar=japanese"), new ULocale("th_TH@calendar=buddhist"), new ULocale("zh_TW@calendar=roc"), new ULocale("ar_IR@calendar=persian"), new ULocale("ar_EG@calendar=islamic"), new ULocale("he_IL@calendar=hebrew"), new ULocale("zh_CN@calendar=chinese"), new ULocale("hi_IN@calendar=indian"), new ULocale("ar_EG@calendar=coptic"), new ULocale("am_ET@calendar=ethiopic") };
int i;
// calendars
Calendar[] calendars = new Calendar[TestLocales.length];
for (i = 0; i < TestLocales.length; i++) {
calendars[i] = Calendar.getInstance(TestLocales[i]);
}
// Creates an instance from a base locale + calendar
DateFormatSymbols[] symbols = new DateFormatSymbols[TestLocales.length];
for (i = 0; i < TestLocales.length; i++) {
symbols[i] = new DateFormatSymbols(calendars[i], new ULocale(TestLocales[i].getBaseName()));
}
// with an instance created from its base locale + calendar class
for (i = 0; i < TestLocales.length; i++) {
DateFormatSymbols dfs = new DateFormatSymbols(calendars[i].getClass(), new ULocale(TestLocales[i].getBaseName()));
if (!dfs.equals(symbols[i])) {
errln("FAIL: DateFormatSymbols created from a base locale and calendar instance" + " is different from one created from the same base locale and calendar class - " + TestLocales[i]);
}
}
}
use of android.icu.text.DateFormatSymbols in project j2objc by google.
the class ChineseTest method TestScratch.
@Test
public void TestScratch() {
String[] strMonths = { "Januari", "Pebruari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "Nopember", "Desember" };
String[] strShortMonths = { "Jan", "Peb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agt", "Sep", "Okt", "Nop", "Des" };
String[] strWeeks = { "", "Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu" };
DateFormatSymbols dfsDate = new DateFormatSymbols(new Locale("id", "ID"));
dfsDate.setMonths(strMonths);
dfsDate.setShortMonths(strShortMonths);
dfsDate.setWeekdays(strWeeks);
ULocale uloInd = dfsDate.getLocale(ULocale.ACTUAL_LOCALE);
if (uloInd == null) {
errln("did not get the expected ULocale");
}
logln(uloInd.toString());
Locale locInd = uloInd.toLocale();
if (locInd == null) {
errln("did not get the expected result");
}
logln(locInd.toString());
}
Aggregations