8167143: CLDR timezone parsing does not work for all locales
authorrgoel
Thu, 22 Dec 2016 06:05:31 +0000
changeset 42930 b878b7b2788e
parent 42929 032d90a24440
child 42931 2e17eb506f5e
8167143: CLDR timezone parsing does not work for all locales Reviewed-by: naoto
jdk/make/gensrc/GensrcLocaleData.gmk
jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java
jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java
jdk/src/java.base/share/classes/java/util/ResourceBundle.java
jdk/test/java/util/Currency/CurrencyTest.java
jdk/test/java/util/TimeZone/Bug8167143.java
jdk/test/sun/util/locale/provider/Bug8038436.java
--- a/jdk/make/gensrc/GensrcLocaleData.gmk	Thu Dec 22 03:35:44 2016 +0000
+++ b/jdk/make/gensrc/GensrcLocaleData.gmk	Thu Dec 22 06:05:31 2016 +0000
@@ -64,7 +64,7 @@
 BASE_LOCALES := en en-US
 
 # Locales that don't have any resource files should be included here.
-ALL_NON_BASE_LOCALES := ja-JP-JP nb-NO nn-NO th-TH-TH
+ALL_NON_BASE_LOCALES := ja-JP-JP th-TH-TH
 
 SED_BASEARGS := -e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
 SED_NONBASEARGS := $(SED_BASEARGS)
@@ -89,6 +89,10 @@
   $1_NON_BASE_LOCALES := $$(subst zh-MO,zh-MO$$(SPACE)zh-Hant-MO, $$($1_NON_BASE_LOCALES))
   $1_NON_BASE_LOCALES := $$(subst zh-TW,zh-TW$$(SPACE)zh-Hant-TW, $$($1_NON_BASE_LOCALES))
 
+# Adding implict locales nn-NO and nb-NO
+  $1_NON_BASE_LOCALES += nn-NO  nb-NO
+  $1_NON_BASE_LOCALES := $$(sort $$($1_NON_BASE_LOCALES))
+
   ALL_BASE_LOCALES += $$($1_BASE_LOCALES)
   ALL_NON_BASE_LOCALES += $$($1_NON_BASE_LOCALES)
 
--- a/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java	Thu Dec 22 03:35:44 2016 +0000
+++ b/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java	Thu Dec 22 06:05:31 2016 +0000
@@ -487,10 +487,43 @@
             metaInfo.get("AvailableLocales").add(toLanguageTag(bundle.getID()));
             addLikelySubtags(metaInfo, "AvailableLocales", bundle.getID());
         }
-
+        addCldrImplicitLocales(metaInfo);
         bundleGenerator.generateMetaInfo(metaInfo);
     }
 
+    /**
+     * These are the Locales that are implicitly supported by CLDR.
+     * Adding them explicitly as likelySubtags here, will ensure that
+     * COMPAT locales do not precede them during ResourceBundle search path.
+     */
+    private static void addCldrImplicitLocales(Map<String, SortedSet<String>> metaInfo) {
+        metaInfo.get("LocaleNames").add("zh-Hans-CN");
+        metaInfo.get("LocaleNames").add("zh-Hans-SG");
+        metaInfo.get("LocaleNames").add("zh-Hant-HK");
+        metaInfo.get("LocaleNames").add("zh-Hant-MO");
+        metaInfo.get("LocaleNames").add("zh-Hant-TW");
+        metaInfo.get("CurrencyNames").add("zh-Hans-CN");
+        metaInfo.get("CurrencyNames").add("zh-Hans-SG");
+        metaInfo.get("CurrencyNames").add("zh-Hant-HK");
+        metaInfo.get("CurrencyNames").add("zh-Hant-MO");
+        metaInfo.get("CurrencyNames").add("zh-Hant-TW");
+        metaInfo.get("TimeZoneNames").add("zh-Hans-CN");
+        metaInfo.get("TimeZoneNames").add("zh-Hans-SG");
+        metaInfo.get("TimeZoneNames").add("zh-Hant-HK");
+        metaInfo.get("TimeZoneNames").add("zh-Hant-MO");
+        metaInfo.get("TimeZoneNames").add("zh-Hant-TW");
+        metaInfo.get("TimeZoneNames").add("zh-HK");
+        metaInfo.get("CalendarData").add("zh-Hans-CN");
+        metaInfo.get("CalendarData").add("zh-Hans-SG");
+        metaInfo.get("CalendarData").add("zh-Hant-HK");
+        metaInfo.get("CalendarData").add("zh-Hant-MO");
+        metaInfo.get("CalendarData").add("zh-Hant-TW");
+        metaInfo.get("FormatData").add("zh-Hans-CN");
+        metaInfo.get("FormatData").add("zh-Hans-SG");
+        metaInfo.get("FormatData").add("zh-Hant-HK");
+        metaInfo.get("FormatData").add("zh-Hant-MO");
+        metaInfo.get("FormatData").add("zh-Hant-TW");
+    }
     static final Map<String, String> aliases = new HashMap<>();
 
     /**
--- a/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java	Thu Dec 22 03:35:44 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java	Thu Dec 22 06:05:31 2016 +0000
@@ -758,16 +758,6 @@
                     dfs = y;
                 }
             }
-            // If the bundle's locale isn't the target locale, put another cache
-            // entry for the bundle's locale.
-            Locale bundleLocale = resource.getLocale();
-            if (!bundleLocale.equals(locale)) {
-                SoftReference<DateFormatSymbols> z
-                    = cachedInstances.putIfAbsent(bundleLocale, ref);
-                if (z != null && z.get() == null) {
-                    cachedInstances.replace(bundleLocale, z, ref);
-                }
-            }
         }
 
         // Copy the field values from dfs to this instance.
--- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Thu Dec 22 03:35:44 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Thu Dec 22 06:05:31 2016 +0000
@@ -2942,17 +2942,6 @@
                             script = "Hans";
                             break;
                         }
-                    } else if (script.length() > 0 && region.length() == 0) {
-                        // Supply region(country) for users who still package Chinese
-                        // bundles using old convension.
-                        switch (script) {
-                        case "Hans":
-                            region = "CN";
-                            break;
-                        case "Hant":
-                            region = "TW";
-                            break;
-                        }
                     }
                 }
 
@@ -2983,6 +2972,21 @@
                 }
                 if (script.length() > 0) {
                     list.add(Locale.getInstance(language, script, "", "", null));
+                    // Special handling for Chinese
+                    if (language.equals("zh")) {
+                        if (region.length() == 0) {
+                            // Supply region(country) for users who still package Chinese
+                            // bundles using old convension.
+                            switch (script) {
+                                case "Hans":
+                                    region = "CN";
+                                    break;
+                                case "Hant":
+                                    region = "TW";
+                                    break;
+                            }
+                        }
+                    }
 
                     // With script, after truncating variant, region and script,
                     // start over without script.
--- a/jdk/test/java/util/Currency/CurrencyTest.java	Thu Dec 22 03:35:44 2016 +0000
+++ b/jdk/test/java/util/Currency/CurrencyTest.java	Thu Dec 22 06:05:31 2016 +0000
@@ -23,7 +23,7 @@
 /*
  * @test
  * @bug 4290801 4692419 4693631 5101540 5104960 6296410 6336600 6371531
- *    6488442 7036905 8008577 8039317 8074350 8074351 8150324
+ *    6488442 7036905 8008577 8039317 8074350 8074351 8150324 8167143
  * @summary Basic tests for Currency class.
  * @modules java.base/java.util:open
  *          jdk.localedata
@@ -188,7 +188,7 @@
     static void testSymbols() {
         testSymbol("USD", Locale.US, "$");
         testSymbol("EUR", Locale.GERMANY, "\u20AC");
-        testSymbol("USD", Locale.PRC, "USD");
+        testSymbol("USD", Locale.PRC, "US$");
     }
 
     static void testSymbol(String currencyCode, Locale locale, String expectedSymbol) {
@@ -262,7 +262,7 @@
         testDisplayName("KRW", Locale.KOREAN, "\ub300\ud55c\ubbfc\uad6d \uc6d0");
         testDisplayName("SEK", new Locale("sv"), "svensk krona");
         testDisplayName("CNY", Locale.SIMPLIFIED_CHINESE, "\u4eba\u6c11\u5e01");
-        testDisplayName("TWD", Locale.TRADITIONAL_CHINESE, "\u65b0\u81fa\u5e63");
+        testDisplayName("TWD", Locale.TRADITIONAL_CHINESE, "\u65b0\u53f0\u5e63");
     }
 
     static void testDisplayName(String currencyCode, Locale locale, String expectedName) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/TimeZone/Bug8167143.java	Thu Dec 22 06:05:31 2016 +0000
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8167143
+ * @summary Test
+ * Timezone parsing works for all locales for default providers prefernce
+ * as well as when  prefernce list is [COMPAT, CLDR],
+ * CLDR implict locales are correctly reflected,
+ * th_TH bundle is not wrongly cached in DateFormatSymbols,
+ * correct candidate locale list is retrieved for
+ * zh_Hant and zh_Hans and
+ * Implict COMPAT Locales nn-NO, nb-NO are reflected in available locales
+ * for all Providers for COMPAT.
+ * @modules java.base/sun.util.locale.provider
+ *          java.base/sun.util.spi
+ *          jdk.localedata
+ * @run main/othervm -Djava.locale.providers=COMPAT,CLDR Bug8167143 testTimeZone
+ * @run main/othervm  Bug8167143 testTimeZone
+ * @run main/othervm -Djava.locale.providers=CLDR Bug8167143 testCldr
+ * @run main/othervm  Bug8167143 testCache
+ * @run main/othervm  Bug8167143 testCandidateLocales
+ * @run main/othervm  -Djava.locale.providers=COMPAT Bug8167143 testCompat
+ */
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.TimeZone;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.LocaleProviderAdapter.Type;
+
+public class Bug8167143 {
+
+    private static final TimeZone REYKJAVIK = TimeZone.getTimeZone("Atlantic/Reykjavik");
+    private static final TimeZone NEW_YORK = TimeZone.getTimeZone("America/New_York");
+    private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
+
+    private static final List<Locale> CLDR_IMPLICIT_LOCS = List.of(Locale.forLanguageTag("zh-Hans-CN"),
+            Locale.forLanguageTag("zh-Hans-SG"),
+            Locale.forLanguageTag("zh-Hant-HK"),
+            Locale.forLanguageTag("zh-Hant-TW"),
+            Locale.forLanguageTag("zh-Hant-MO"));
+
+    private static final List<Locale> COMPAT_IMPLICIT_LOCS = List.of(Locale.forLanguageTag("nn-NO"),
+            Locale.forLanguageTag("nb-NO"));
+    /**
+     * List of candidate locales for zh_Hant
+     */
+    private static final List<Locale> ZH_HANT_CANDLOCS = List.of(
+            Locale.forLanguageTag("zh-Hant"),
+            Locale.forLanguageTag("zh-TW"),
+            Locale.forLanguageTag("zh"),
+            Locale.ROOT);
+    /**
+     * List of candidate locales for zh_Hans
+     */
+    private static final List<Locale> ZH_HANS_CANDLOCS = List.of(
+            Locale.forLanguageTag("zh-Hans"),
+            Locale.forLanguageTag("zh-CN"),
+            Locale.forLanguageTag("zh"),
+            Locale.ROOT);
+
+    public static void main(String[] args) {
+        switch (args[0]) {
+            case "testTimeZone":
+                testTimeZoneParsing();
+                break;
+            case "testCldr":
+                testImplicitCldrLocales();
+                break;
+            case "testCache":
+                testDateFormatSymbolsCache();
+                break;
+            case "testCandidateLocales":
+                testCandidateLocales();
+                break;
+            case "testCompat":
+                testImplicitCompatLocales();
+                break;
+            default:
+                throw new RuntimeException("no test was specified.");
+        }
+    }
+
+    /**
+     * Check that if Locale Provider Preference list is Default, or if Locale
+     * Provider Preference List is COMPAT,CLDR SimplDateFormat parsing works for
+     * all Available Locales.
+     */
+    private static void testTimeZoneParsing() {
+        Set<Locale> locales = Set.of(Locale.forLanguageTag("zh-hant"), new Locale("no", "NO", "NY"));
+        // Set<Locale> locales = Set.of(Locale.getAvailableLocales());
+        locales.forEach((locale) -> {
+            final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd z", locale);
+            for (final TimeZone tz : new TimeZone[]{REYKJAVIK, GMT, NEW_YORK}) {
+                try {
+                    sdf.parse("2000/02/10 " + tz.getDisplayName(locale));
+                } catch (ParseException e) {
+                    throw new RuntimeException("TimeZone Parsing failed with Locale "
+                            + locale + " for TimeZone  " + tz.getDisplayName(), e);
+                }
+            }
+        });
+    }
+
+    /**
+     * Check that locales implicitly supported from CLDR are reflected in output
+     * from getAvailbleLocales() for each bundle.
+     *
+     */
+    private static void testImplicitCldrLocales() {
+        LocaleProviderAdapter cldr = LocaleProviderAdapter.forType(Type.CLDR);
+        checkPresenceCldr("CurrencyNameProvider",
+                cldr.getCurrencyNameProvider().getAvailableLocales());
+        checkPresenceCldr("LocaleNameProvider",
+                cldr.getLocaleNameProvider().getAvailableLocales());
+        checkPresenceCldr("TimeZoneNameProvider",
+                cldr.getTimeZoneNameProvider().getAvailableLocales());
+        checkPresenceCldr("CalendarDataProvider",
+                cldr.getCalendarDataProvider().getAvailableLocales());
+        checkPresenceCldr("CalendarNameProvider",
+                cldr.getCalendarProvider().getAvailableLocales());
+    }
+
+    private static void checkPresenceCldr(String testName, Locale[] got) {
+        List<Locale> gotLocalesList = Arrays.asList(got);
+        List<Locale> gotList = new ArrayList<>(gotLocalesList);
+        if (!testName.equals("TimeZoneNameProvider")) {
+            if (!gotList.removeAll(CLDR_IMPLICIT_LOCS)) {
+                // check which locale are not present in retrievedLocales List.
+                List<Locale> expectedLocales = new ArrayList<>(CLDR_IMPLICIT_LOCS);
+                expectedLocales.removeAll(gotList);
+                throw new RuntimeException("Locales those not correctly reflected are "
+                        + expectedLocales + " for test " + testName);
+            }
+        } else {
+            // check one extra locale zh_HK for TimeZoneNameProvider
+            Locale zh_HK = Locale.forLanguageTag("zh-HK");
+            if (!gotList.removeAll(CLDR_IMPLICIT_LOCS) && gotList.remove(zh_HK)) {
+                //check which locale are not present in retrievedLocales List
+                List<Locale> expectedLocales = new ArrayList<>(CLDR_IMPLICIT_LOCS);
+                expectedLocales.add(zh_HK);
+                expectedLocales.removeAll(gotList);
+                throw new RuntimeException("Locales those not correctly reflected are "
+                        + expectedLocales + " for test " + testName);
+            }
+        }
+    }
+
+    /**
+     * Check that if Locale Provider Preference list is default and if
+     * SimpleDateFormat instance for th-TH-TH is created first, then JRE bundle
+     * for th-TH should not be cached in cache of DateFormatSymbols class.
+     */
+    private static void testDateFormatSymbolsCache() {
+        Locale th_TH_TH = new Locale("th", "TH", "TH");
+        Locale th_TH = new Locale("th", "TH");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd z", th_TH_TH);
+        String[][] thTHTHZoneStrings = sdf.getDateFormatSymbols().getZoneStrings();
+        String[][] thTHZoneStrings = sdf.getDateFormatSymbols().getZoneStrings();
+        if (Arrays.equals(thTHTHZoneStrings, thTHZoneStrings)) {
+            throw new RuntimeException("th_TH bundle still cached with DateFormatSymbols"
+                    + "cache for locale  " + th_TH
+            );
+        }
+    }
+
+    /**
+     * Check that candidate locales list retrieved for zh__Hant and for zh__Hans
+     * do not have first candidate locale as zh_TW_Hant and zh_CN_Hans
+     * respectively.
+     */
+    private static void testCandidateLocales() {
+        ResourceBundle.Control Control = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
+        Locale zh_Hant = Locale.forLanguageTag("zh-Hant");
+        Locale zh_Hans = Locale.forLanguageTag("zh-Hans");
+        List<Locale> zhHantCandidateLocs = Control.getCandidateLocales("", zh_Hant);
+        List<Locale> zhHansCandidateLocs = Control.getCandidateLocales("", zh_Hans);
+        if (!zhHantCandidateLocs.equals(ZH_HANT_CANDLOCS)) {
+            reportDifference(zhHantCandidateLocs, ZH_HANT_CANDLOCS, "zh_Hant");
+
+        }
+        if (!zhHansCandidateLocs.equals(ZH_HANS_CANDLOCS)) {
+            reportDifference(zhHansCandidateLocs, ZH_HANS_CANDLOCS, "zh_Hans");
+
+        }
+    }
+
+    private static void reportDifference(List<Locale> got, List<Locale> expected, String locale) {
+        List<Locale> retrievedList = new ArrayList<>(got);
+        List<Locale> expectedList = new ArrayList<>(expected);
+        retrievedList.removeAll(expectedList);
+        expectedList.removeAll(retrievedList);
+        if ((retrievedList.size() > 0) && (expectedList.size() > 0)) {
+            throw new RuntimeException(" retrievedList contain extra candidate locales " + retrievedList
+                    + " and missing candidate locales " + expectedList
+                    + "for locale " + locale);
+        }
+        if ((retrievedList.size() > 0)) {
+            throw new RuntimeException(" retrievedList contain extra candidate locales " + retrievedList
+                    + "for locale " + locale);
+        }
+        if ((expectedList.size() > 0)) {
+            throw new RuntimeException(" retrievedList contain extra candidate locales " + expectedList
+                    + "for locale " + locale);
+        }
+    }
+
+    /**
+     * checks that locales nn-NO  and nb-NO should be present in list of supported locales for
+     * all Providers for COMPAT.
+     */
+    private static void testImplicitCompatLocales() {
+        LocaleProviderAdapter jre = LocaleProviderAdapter.forJRE();
+        checkPresenceCompat("BreakIteratorProvider",
+            jre.getBreakIteratorProvider().getAvailableLocales());
+        checkPresenceCompat("CollatorProvider",
+            jre.getCollatorProvider().getAvailableLocales());
+        checkPresenceCompat("DateFormatProvider",
+            jre.getDateFormatProvider().getAvailableLocales());
+        checkPresenceCompat("DateFormatSymbolsProvider",
+            jre.getDateFormatSymbolsProvider().getAvailableLocales());
+        checkPresenceCompat("DecimalFormatSymbolsProvider",
+            jre.getDecimalFormatSymbolsProvider().getAvailableLocales());
+        checkPresenceCompat("NumberFormatProvider",
+            jre.getNumberFormatProvider().getAvailableLocales());
+        checkPresenceCompat("CurrencyNameProvider",
+            jre.getCurrencyNameProvider().getAvailableLocales());
+        checkPresenceCompat("LocaleNameProvider",
+            jre.getLocaleNameProvider().getAvailableLocales());
+        checkPresenceCompat("TimeZoneNameProvider",
+            jre.getTimeZoneNameProvider().getAvailableLocales());
+        checkPresenceCompat("CalendarDataProvider",
+            jre.getCalendarDataProvider().getAvailableLocales());
+        checkPresenceCompat("CalendarNameProvider",
+            jre.getCalendarNameProvider().getAvailableLocales());
+        checkPresenceCompat("CalendarProvider",
+            jre.getCalendarProvider().getAvailableLocales());
+    }
+
+    private static void checkPresenceCompat(String testName, Locale[] got) {
+        List<Locale> gotLocalesList = Arrays.asList(got);
+        List<Locale> gotList = new ArrayList<>(gotLocalesList);
+            if (!gotList.removeAll(COMPAT_IMPLICIT_LOCS)) {
+                // check which Implicit locale are not present in retrievedLocales List.
+                List<Locale> implicitLocales = new ArrayList<>(COMPAT_IMPLICIT_LOCS);
+                implicitLocales.removeAll(gotList);
+                throw new RuntimeException("Locales those not correctly reflected are "
+                        + implicitLocales + " for test " + testName);
+            }
+    }
+}
--- a/jdk/test/sun/util/locale/provider/Bug8038436.java	Thu Dec 22 03:35:44 2016 +0000
+++ b/jdk/test/sun/util/locale/provider/Bug8038436.java	Thu Dec 22 06:05:31 2016 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8038436 8158504 8065555
+ * @bug 8038436 8158504 8065555 8167143
  * @summary Test for changes in 8038436
  * @modules java.base/sun.util.locale.provider
  *          java.base/sun.util.spi
@@ -120,7 +120,7 @@
         "fi, fi-FI, fr, fr-BE, fr-CA, fr-CH, fr-FR, ga, ga-IE, he, he-IL, " +
         "hi-IN, hr, hr-HR, hu, hu-HU, id, id-ID, is, is-IS, it, it-CH, it-IT, " +
         "ja, ja-JP, ko, ko-KR, lt, lt-LT, lv, lv-LV, mk, mk-MK, ms, ms-MY, mt, " +
-        "mt-MT, nl, nl-BE, nl-NL, no, no-NO, no-NO, pl, pl-PL, pt, pt-BR, " +
+        "mt-MT, nb-NO, nl, nl-BE, nl-NL, nn-NO, no, no-NO, no-NO, pl, pl-PL, pt, pt-BR, " +
         "pt-PT, ro, ro-RO, ru, ru-RU, sk, sk-SK, sl, sl-SI, sq, sq-AL, sr, " +
         "sr-BA, sr-CS, sr-Latn, sr-Latn-ME, sr-ME, sr-RS, sv, sv-SE, th, th-TH, " +
         "tr, tr-TR, uk, uk-UA, und, vi, vi-VN, zh, zh-CN, zh-HK, zh-Hans-CN, " +
@@ -130,7 +130,7 @@
     static final String[] decimalfspLocs = bipLocs;
     static final String[] calnpLocs = bipLocs;
     static final String[] cpLocs = ("ar, be, bg, ca, cs, da, el, es, et, fi, " +
-        "fr, he, hi, hr, hu, is, ja, ko, lt, lv, mk, no, pl, ro, ru, sk, sl, " +
+        "fr, he, hi, hr, hu, is, ja, ko, lt, lv, mk, nb-NO, nn-NO, no, pl, ro, ru, sk, sl, " +
         "sq, sr, sr-Latn, sv, th, tr, uk, und, vi, zh, zh-HK, zh-Hant-HK, " +
         "zh-Hant-TW, zh-TW, ").split(",\\s*");
     static final String[] nfpLocs = ("ar, ar-AE, ar-BH, ar-DZ, ar-EG, ar-IQ, " +
@@ -160,22 +160,22 @@
         "es-PA, es-PE, es-PR, es-PY, es-SV, es-US, es-UY, es-VE, et-EE, fi-FI, " +
         "fr, fr-BE, fr-CA, fr-CH, fr-FR, fr-LU, ga-IE, he-IL, hi-IN, hr-HR, " +
         "hu-HU, id-ID, is-IS, it, it-CH, it-IT, ja, ja-JP, ko, ko-KR, lt-LT, " +
-        "lv-LV, mk-MK, ms-MY, mt-MT, nl-BE, nl-NL, no-NO, pl-PL, pt, pt-BR, " +
+        "lv-LV, mk-MK, ms-MY, mt-MT, nb-NO, nl-BE, nl-NL, nn-NO, no-NO, pl-PL, pt, pt-BR, " +
         "pt-PT, ro-RO, ru-RU, sk-SK, sl-SI, sq-AL, sr-BA, sr-CS, sr-Latn-BA, " +
         "sr-Latn-ME, sr-Latn-RS, sr-ME, sr-RS, sv, sv-SE, th-TH, tr-TR, uk-UA, " +
         "und, vi-VN, zh-CN, zh-HK, zh-Hans-CN, zh-Hans-SG, zh-Hant-HK, " +
         "zh-Hant-TW, zh-SG, zh-TW, ").split(",\\s*");
     static final String[] lnpLocs = ("ar, be, bg, ca, cs, da, de, el, el-CY, " +
         "en, en-MT, en-PH, en-SG, es, es-US, et, fi, fr, ga, he, hi, hr, hu, " +
-        "id, is, it, ja, ko, lt, lv, mk, ms, mt, nl, no, no-NO, pl, pt, pt-BR, " +
+        "id, is, it, ja, ko, lt, lv, mk, ms, mt, nb-NO, nl, nn-NO, no, no-NO, pl, pt, pt-BR, " +
         "pt-PT, ro, ru, sk, sl, sq, sr, sr-Latn, sv, th, tr, uk, und, vi, zh, " +
         "zh-HK, zh-Hans-SG, zh-Hant-HK, zh-Hant-TW, zh-SG, zh-TW, ").split(",\\s*");
     static final String[] tznpLocs = ("de, en, en-CA, en-GB, en-IE, es, fr, hi, " +
-        "it, ja, ko, pt-BR, sv, und, zh-CN, zh-HK, zh-Hans-CN, zh-Hant-HK, " +
+        "it, ja, ko, nb-NO, nn-NO, pt-BR, sv, und, zh-CN, zh-HK, zh-Hans-CN, zh-Hant-HK, " +
         "zh-Hant-TW, zh-TW, ").split(",\\s*");
     static final String[] caldpLocs = ("ar, be, bg, ca, cs, da, de, el, el-CY, " +
         "en, en-GB, en-IE, en-MT, es, es-ES, es-US, et, fi, fr, fr-CA, he, hi, " +
-        "hr, hu, id-ID, is, it, ja, ko, lt, lv, mk, ms-MY, mt, mt-MT, nl, no, " +
+        "hr, hu, id-ID, is, it, ja, ko, lt, lv, mk, ms-MY, mt, mt-MT, nb-NO, nl, nn-NO, no, " +
         "pl, pt, pt-BR, pt-PT, ro, ru, sk, sl, sq, sr, sr-Latn-BA, sr-Latn-ME, " +
         "sr-Latn-RS, sv, th, tr, uk, und, vi, zh, ").split(",\\s*");
     static final String[] calpLocs = caldpLocs;