< prev index next >

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

Print this page
rev 47733 : 8176841: Additional Unicode Language-Tag Extensions
8189134: New system properties for the default Locale extensions
Reviewed-by:

@@ -284,17 +284,21 @@
     //-----------------------------------------------------------------------
     /**
      * 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");
-        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);
< prev index next >