< prev index next >

src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, 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.  Oracle designates this

@@ -193,11 +193,28 @@
         }
 
         return parent;
     }
 
+    /**
+     * This method returns equivalent CLDR supported locale for zh-HK,
+     * no, no-NO locales so that COMPAT locales do not precede
+     * those locales during ResourceBundle search path.
+     */
+    private static Locale getEquivalentLoc(Locale locale) {
+        switch (locale.toString()) {
+            case "zh_HK":
+                return Locale.forLanguageTag("zh-Hant-HK");
+            case "no":
+            case "no_NO":
+                return Locale.forLanguageTag("nb");
+        }
+        return locale;
+    }
+
     @Override
     public boolean isSupportedProviderLocale(Locale locale, Set<String> langtags) {
-        return Locale.ROOT.equals(locale) ||
-            langtags.contains(locale.stripExtensions().toLanguageTag());
+        return Locale.ROOT.equals(locale)
+                || langtags.contains(locale.stripExtensions().toLanguageTag())
+                || langtags.contains(getEquivalentLoc(locale).toLanguageTag());
     }
 }
< prev index next >