mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8258794: Support for CLDR version 39
Reviewed-by: joehw, erikj
This commit is contained in:
parent
e89fd15189
commit
f6e54f2f9a
815 changed files with 19736 additions and 25498 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, 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
|
||||
|
@ -26,7 +26,6 @@
|
|||
package sun.util.cldr;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.AccessControlException;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
@ -40,7 +39,6 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -80,19 +78,16 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
|||
}
|
||||
|
||||
public CLDRLocaleProviderAdapter() {
|
||||
LocaleDataMetaInfo nbmi = null;
|
||||
LocaleDataMetaInfo nbmi;
|
||||
|
||||
try {
|
||||
nbmi = AccessController.doPrivileged(new PrivilegedExceptionAction<LocaleDataMetaInfo>() {
|
||||
@Override
|
||||
public LocaleDataMetaInfo run() {
|
||||
for (LocaleDataMetaInfo ldmi : ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) {
|
||||
if (ldmi.getType() == LocaleProviderAdapter.Type.CLDR) {
|
||||
return ldmi;
|
||||
}
|
||||
nbmi = AccessController.doPrivileged((PrivilegedExceptionAction<LocaleDataMetaInfo>) () -> {
|
||||
for (LocaleDataMetaInfo ldmi : ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) {
|
||||
if (ldmi.getType() == Type.CLDR) {
|
||||
return ldmi;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw new InternalError(pae.getCause());
|
||||
|
@ -248,6 +243,10 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
|||
if (p != null &&
|
||||
!candidates.get(i+1).equals(p)) {
|
||||
List<Locale> applied = candidates.subList(0, i+1);
|
||||
if (applied.contains(p)) {
|
||||
// avoid circular recursion (could happen with nb/no case)
|
||||
continue;
|
||||
}
|
||||
applied.addAll(applyParentLocales(baseName, super.getCandidateLocales(baseName, p)));
|
||||
return applied;
|
||||
}
|
||||
|
@ -289,12 +288,10 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
|||
* it returns equivalent locale, e.g for zh_HK it returns zh_Hant-HK.
|
||||
*/
|
||||
private static Locale getEquivalentLoc(Locale locale) {
|
||||
switch (locale.toString()) {
|
||||
case "no":
|
||||
case "no_NO":
|
||||
return Locale.forLanguageTag("nb");
|
||||
}
|
||||
return applyAliases(locale);
|
||||
return switch (locale.toString()) {
|
||||
case "no", "no_NO" -> Locale.forLanguageTag("nb");
|
||||
default -> applyAliases(locale);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue