< prev index next >

src/java.base/share/classes/java/time/temporal/WeekFields.java

Print this page
rev 47480 : [mq]: 8176841

*** 284,300 **** //----------------------------------------------------------------------- /** * Obtains an instance of {@code WeekFields} appropriate for a locale. * <p> * This will look up appropriate values from the provider of localization data. * * @param locale the locale to use, not null * @return the week-definition, not null */ public static WeekFields of(Locale locale) { Objects.requireNonNull(locale, "locale"); - locale = new Locale(locale.getLanguage(), locale.getCountry()); // elminate variants int calDow = CalendarDataUtility.retrieveFirstDayOfWeek(locale); DayOfWeek dow = DayOfWeek.SUNDAY.plus(calDow - 1); int minDays = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(locale); return WeekFields.of(dow, minDays); --- 284,304 ---- //----------------------------------------------------------------------- /** * Obtains an instance of {@code WeekFields} appropriate for a locale. * <p> * This will look up appropriate values from the provider of localization data. + * If the locale contains "fw" (First day of week) and/or "rg" + * (Region Override) <a href="../../util/Locale.html#def_locale_extension"> + * Unicode extensions</a>, returned instance will reflect the values specified with + * those extensions. If both "fw" and "rg" are specified, the value from + * "fw" extension supersedes the implicit one from "rg" extension. * * @param locale the locale to use, not null * @return the week-definition, not null */ public static WeekFields of(Locale locale) { Objects.requireNonNull(locale, "locale"); int calDow = CalendarDataUtility.retrieveFirstDayOfWeek(locale); DayOfWeek dow = DayOfWeek.SUNDAY.plus(calDow - 1); int minDays = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(locale); return WeekFields.of(dow, minDays);
< prev index next >