use of libcore.icu.LocaleData in project robolectric by robolectric.
the class ShadowLocaleData method get.
@Implementation
public static LocaleData get(Locale locale) {
LocaleData localeData = (LocaleData) Shadow.newInstanceOf(REAL_CLASS_NAME);
if (locale == null) {
locale = Locale.getDefault();
}
setEnUsLocaleData(localeData);
return localeData;
}
use of libcore.icu.LocaleData in project robolectric by robolectric.
the class ShadowLocaleDataTest method shouldSupportLocaleEn_US.
@Test
public void shouldSupportLocaleEn_US() throws Exception {
LocaleData localeData = LocaleData.get(Locale.US);
assertThat(localeData.amPm).isEqualTo(new String[] { "AM", "PM" });
assertThat(localeData.eras).isEqualTo(new String[] { "BC", "AD" });
assertThat(localeData.firstDayOfWeek).isEqualTo(1);
assertThat(localeData.minimalDaysInFirstWeek).isEqualTo(1);
assertThat(localeData.longMonthNames).isEqualTo(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" });
assertThat(localeData.shortMonthNames).isEqualTo(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" });
assertThat(localeData.longStandAloneMonthNames).isEqualTo(localeData.longMonthNames);
assertThat(localeData.shortStandAloneMonthNames).isEqualTo(localeData.shortMonthNames);
assertThat(localeData.longWeekdayNames).isEqualTo(new String[] { "", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" });
assertThat(localeData.shortWeekdayNames).isEqualTo(new String[] { "", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" });
assertThat(localeData.longStandAloneWeekdayNames).isEqualTo(localeData.longWeekdayNames);
assertThat(localeData.shortStandAloneWeekdayNames).isEqualTo(localeData.shortWeekdayNames);
assertThat(localeData.fullTimeFormat).isEqualTo("h:mm:ss a zzzz");
assertThat(localeData.longTimeFormat).isEqualTo("h:mm:ss a z");
assertThat(localeData.mediumTimeFormat).isEqualTo("h:mm:ss a");
assertThat(localeData.shortTimeFormat).isEqualTo("h:mm a");
assertThat(localeData.fullDateFormat).isEqualTo("EEEE, MMMM d, y");
assertThat(localeData.longDateFormat).isEqualTo("MMMM d, y");
assertThat(localeData.mediumDateFormat).isEqualTo("MMM d, y");
assertThat(localeData.shortDateFormat).isEqualTo("M/d/yy");
assertThat(localeData.zeroDigit).isEqualTo('0');
assertThat(localeData.decimalSeparator).isEqualTo('.');
assertThat(localeData.groupingSeparator).isEqualTo(',');
assertThat(localeData.patternSeparator).isEqualTo(';');
assertThat(localeData.perMill).isEqualTo('‰');
assertThat(localeData.monetarySeparator).isEqualTo('.');
assertThat(localeData.exponentSeparator).isEqualTo("E");
assertThat(localeData.infinity).isEqualTo("∞");
assertThat(localeData.NaN).isEqualTo("NaN");
assertThat(localeData.currencySymbol).isEqualTo("$");
assertThat(localeData.internationalCurrencySymbol).isEqualTo("USD");
assertThat(localeData.numberPattern).isEqualTo("#,##0.###");
assertThat(localeData.integerPattern).isEqualTo("#,##0");
assertThat(localeData.currencyPattern).isEqualTo("¤#,##0.00;(¤#,##0.00)");
assertThat(localeData.percentPattern).isEqualTo("#,##0%");
}
use of libcore.icu.LocaleData in project robolectric by robolectric.
the class ShadowLocaleDataTest method shouldSupportLocaleEn_US_since_jelly_bean_mr1.
@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void shouldSupportLocaleEn_US_since_jelly_bean_mr1() throws Exception {
LocaleData localeData = LocaleData.get(Locale.US);
assertThat(localeData.tinyMonthNames).isEqualTo(new String[] { "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" });
assertThat(localeData.tinyStandAloneMonthNames).isEqualTo(localeData.tinyMonthNames);
assertThat(localeData.tinyWeekdayNames).isEqualTo(new String[] { "", "S", "M", "T", "W", "T", "F", "S" });
assertThat(localeData.tinyStandAloneWeekdayNames).isEqualTo(localeData.tinyWeekdayNames);
assertThat(localeData.yesterday).isEqualTo("Yesterday");
assertThat(localeData.today).isEqualTo("Today");
assertThat(localeData.tomorrow).isEqualTo("Tomorrow");
}
use of libcore.icu.LocaleData in project robolectric by robolectric.
the class ShadowLocaleDataTest method shouldSupportLocaleEn_US_since_lollipop.
@Test
@Config(minSdk = LOLLIPOP)
public void shouldSupportLocaleEn_US_since_lollipop() throws Exception {
LocaleData localeData = LocaleData.get(Locale.US);
assertThat(localeData.minusSign).isEqualTo("-");
}
use of libcore.icu.LocaleData in project android_frameworks_base by ResurrectionRemix.
the class TimePickerSpinnerDelegate method getAmPmStrings.
public static String[] getAmPmStrings(Context context) {
String[] result = new String[2];
LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
result[0] = d.amPm[0].length() > 4 ? d.narrowAm : d.amPm[0];
result[1] = d.amPm[1].length() > 4 ? d.narrowPm : d.amPm[1];
return result;
}
Aggregations