// the likely subtags.
// 2). If the locale has an unnecessary script designation then we ignore it,
// ( i.e. "en_Latn_US" becomes "en_US" )
ULocale useLocale;
CalendarData calData = new CalendarData(locale, getType());
ULocale min = ULocale.minimizeSubtags(calData.getULocale());
if (min.getCountry().length() > 0) {
useLocale = min;
} else {
ULocale max = ULocale.addLikelySubtags(min);
StringBuilder buf = new StringBuilder();
buf.append(min.getLanguage());
if (min.getScript().length() > 0) {
buf.append("_" + min.getScript());
}
if (max.getCountry().length() > 0) {
buf.append("_" + max.getCountry());
}
if (min.getVariant().length() > 0) {
buf.append("_" + min.getVariant());
}
useLocale = new ULocale(buf.toString());
}
UResourceBundle rb = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "supplementalData",
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
UResourceBundle weekDataInfo = rb.get("weekData");
UResourceBundle weekDataBundle = null;
try {
weekDataBundle = weekDataInfo.get(useLocale.getCountry());
} catch (MissingResourceException mre) {
// use "001" as fallback
weekDataBundle = weekDataInfo.get("001");
}
int[] wdi = weekDataBundle.getIntVector();
data = new WeekData(wdi[0], wdi[1], wdi[2], wdi[3], wdi[4], wdi[5], calData.getULocale());
/* cache update */
cachedLocaleData.put(locale, data);
}
setFirstDayOfWeek(data.firstDayOfWeek);