8263202: Update Hebrew/Indonesian/Yiddish ISO 639 language codes to current
Reviewed-by: joehw
This commit is contained in:
parent
9c346a1ec7
commit
a4c46e1e4f
@ -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
|
||||
@ -156,13 +156,6 @@ class Bundle {
|
||||
return id;
|
||||
}
|
||||
|
||||
String getJavaID() {
|
||||
// Tweak ISO compatibility for bundle generation
|
||||
return id.replaceFirst("^he", "iw")
|
||||
.replaceFirst("^id", "in")
|
||||
.replaceFirst("^yi", "ji");
|
||||
}
|
||||
|
||||
boolean isRoot() {
|
||||
return "root".equals(id);
|
||||
}
|
||||
|
@ -536,7 +536,6 @@ public class CLDRConverter {
|
||||
Map<String, Object> targetMap = bundle.getTargetMap();
|
||||
EnumSet<Bundle.Type> bundleTypes = bundle.getBundleTypes();
|
||||
var id = bundle.getID();
|
||||
var javaId = bundle.getJavaID();
|
||||
|
||||
if (bundle.isRoot()) {
|
||||
// Add DateTimePatternChars because CLDR no longer supports localized patterns.
|
||||
@ -548,31 +547,31 @@ public class CLDRConverter {
|
||||
if (bundleTypes.contains(Bundle.Type.LOCALENAMES)) {
|
||||
Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, id);
|
||||
if (!localeNamesMap.isEmpty() || bundle.isRoot()) {
|
||||
bundleGenerator.generateBundle("util", "LocaleNames", javaId, true, localeNamesMap, BundleType.OPEN);
|
||||
bundleGenerator.generateBundle("util", "LocaleNames", id, true, localeNamesMap, BundleType.OPEN);
|
||||
}
|
||||
}
|
||||
if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) {
|
||||
Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, id, bundle.getCurrencies());
|
||||
if (!currencyNamesMap.isEmpty() || bundle.isRoot()) {
|
||||
bundleGenerator.generateBundle("util", "CurrencyNames", javaId, true, currencyNamesMap, BundleType.OPEN);
|
||||
bundleGenerator.generateBundle("util", "CurrencyNames", id, true, currencyNamesMap, BundleType.OPEN);
|
||||
}
|
||||
}
|
||||
if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) {
|
||||
Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, id);
|
||||
if (!zoneNamesMap.isEmpty() || bundle.isRoot()) {
|
||||
bundleGenerator.generateBundle("util", "TimeZoneNames", javaId, true, zoneNamesMap, BundleType.TIMEZONE);
|
||||
bundleGenerator.generateBundle("util", "TimeZoneNames", id, true, zoneNamesMap, BundleType.TIMEZONE);
|
||||
}
|
||||
}
|
||||
if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) {
|
||||
Map<String, Object> calendarDataMap = extractCalendarData(targetMap, id);
|
||||
if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
|
||||
bundleGenerator.generateBundle("util", "CalendarData", javaId, true, calendarDataMap, BundleType.PLAIN);
|
||||
bundleGenerator.generateBundle("util", "CalendarData", id, true, calendarDataMap, BundleType.PLAIN);
|
||||
}
|
||||
}
|
||||
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
|
||||
Map<String, Object> formatDataMap = extractFormatData(targetMap, id);
|
||||
if (!formatDataMap.isEmpty() || bundle.isRoot()) {
|
||||
bundleGenerator.generateBundle("text", "FormatData", javaId, true, formatDataMap, BundleType.PLAIN);
|
||||
bundleGenerator.generateBundle("text", "FormatData", id, true, formatDataMap, BundleType.PLAIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -444,18 +444,26 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
||||
* in <a href="#special_cases_constructor">Special Cases</a>, only
|
||||
* for the two cases th_TH_TH and ja_JP_JP.
|
||||
*
|
||||
* <h4>Legacy language codes</h4>
|
||||
* <h4><a id="legacy_language_codes">Legacy language codes</a></h4>
|
||||
*
|
||||
* <p>Locale's constructor has always converted three language codes to
|
||||
* their earlier, obsoleted forms: {@code he} maps to {@code iw},
|
||||
* {@code yi} maps to {@code ji}, and {@code id} maps to
|
||||
* {@code in}. This continues to be the case, in order to not break
|
||||
* backwards compatibility.
|
||||
* {@code in}. Since Java SE 17, this is no longer the case. Each
|
||||
* language maps to its new form; {@code iw} maps to {@code he}, {@code ji}
|
||||
* maps to {@code yi}, and {@code in} maps to {@code id}.
|
||||
*
|
||||
* <p>For the backward compatible behavior, the system property
|
||||
* {@systemProperty java.locale.useOldISOCodes} reverts the behavior
|
||||
* back to prior to Java SE 17 one. If the system property is set
|
||||
* to {@code true}, those three current language codes are mapped to their
|
||||
* backward compatible forms.
|
||||
*
|
||||
* <p>The APIs added in 1.7 map between the old and new language codes,
|
||||
* maintaining the old codes internal to Locale (so that
|
||||
* {@code getLanguage} and {@code toString} reflect the old
|
||||
* code), but using the new codes in the BCP 47 language tag APIs (so
|
||||
* maintaining the mapped codes internal to Locale (so that
|
||||
* {@code getLanguage} and {@code toString} reflect the mapped
|
||||
* code, which depends on the {@code java.locale.useOldISOCodes} system
|
||||
* property), but using the new codes in the BCP 47 language tag APIs (so
|
||||
* that {@code toLanguageTag} reflects the new one). This
|
||||
* preserves the equivalence between Locales no matter which code or
|
||||
* API is used to construct them. Java's default resource bundle
|
||||
@ -720,13 +728,11 @@ public final class Locale implements Cloneable, Serializable {
|
||||
* Construct a locale from language, country and variant.
|
||||
* This constructor normalizes the language value to lowercase and
|
||||
* the country value to uppercase.
|
||||
* <p>
|
||||
* <b>Note:</b>
|
||||
* @implNote
|
||||
* <ul>
|
||||
* <li>ISO 639 is not a stable standard; some of the language codes it defines
|
||||
* (specifically "iw", "ji", and "in") have changed. This constructor accepts both the
|
||||
* old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other
|
||||
* API on Locale will return only the OLD codes.
|
||||
* <li>Obsolete ISO 639 codes ("iw", "ji", and "in") are mapped to
|
||||
* their current forms. See <a href="#legacy_language_codes">Legacy language
|
||||
* codes</a> for more information.
|
||||
* <li>For backward compatibility reasons, this constructor does not make
|
||||
* any syntactic checks on the input.
|
||||
* <li>The two cases ("ja", "JP", "JP") and ("th", "TH", "TH") are handled specially,
|
||||
@ -754,13 +760,11 @@ public final class Locale implements Cloneable, Serializable {
|
||||
* Construct a locale from language and country.
|
||||
* This constructor normalizes the language value to lowercase and
|
||||
* the country value to uppercase.
|
||||
* <p>
|
||||
* <b>Note:</b>
|
||||
* @implNote
|
||||
* <ul>
|
||||
* <li>ISO 639 is not a stable standard; some of the language codes it defines
|
||||
* (specifically "iw", "ji", and "in") have changed. This constructor accepts both the
|
||||
* old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other
|
||||
* API on Locale will return only the OLD codes.
|
||||
* <li>Obsolete ISO 639 codes ("iw", "ji", and "in") are mapped to
|
||||
* their current forms. See <a href="#legacy_language_codes">Legacy language
|
||||
* codes</a> for more information.
|
||||
* <li>For backward compatibility reasons, this constructor does not make
|
||||
* any syntactic checks on the input.
|
||||
* </ul>
|
||||
@ -779,13 +783,11 @@ public final class Locale implements Cloneable, Serializable {
|
||||
/**
|
||||
* Construct a locale from a language code.
|
||||
* This constructor normalizes the language value to lowercase.
|
||||
* <p>
|
||||
* <b>Note:</b>
|
||||
* @implNote
|
||||
* <ul>
|
||||
* <li>ISO 639 is not a stable standard; some of the language codes it defines
|
||||
* (specifically "iw", "ji", and "in") have changed. This constructor accepts both the
|
||||
* old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other
|
||||
* API on Locale will return only the OLD codes.
|
||||
* <li>Obsolete ISO 639 codes ("iw", "ji", and "in") are mapped to
|
||||
* their current forms. See <a href="#legacy_language_codes">Legacy language
|
||||
* codes</a> for more information.
|
||||
* <li>For backward compatibility reasons, this constructor does not make
|
||||
* any syntactic checks on the input.
|
||||
* </ul>
|
||||
@ -1207,19 +1209,10 @@ public final class Locale implements Cloneable, Serializable {
|
||||
/**
|
||||
* Returns the language code of this Locale.
|
||||
*
|
||||
* <p><b>Note:</b> ISO 639 is not a stable standard— some languages' codes have changed.
|
||||
* Locale's constructor recognizes both the new and the old codes for the languages
|
||||
* whose codes have changed, but this function always returns the old code. If you
|
||||
* want to check for a specific language whose code has changed, don't do
|
||||
* <pre>
|
||||
* if (locale.getLanguage().equals("he")) // BAD!
|
||||
* ...
|
||||
* </pre>
|
||||
* Instead, do
|
||||
* <pre>
|
||||
* if (locale.getLanguage().equals(new Locale("he").getLanguage()))
|
||||
* ...
|
||||
* </pre>
|
||||
* @implNote This method returns the new forms for the obsolete ISO 639
|
||||
* codes ("iw", "ji", and "in"). See <a href="#legacy_language_codes">
|
||||
* Legacy language codes</a> for more information.
|
||||
*
|
||||
* @return The language code, or the empty string if none is defined.
|
||||
* @see #getDisplayLanguage
|
||||
*/
|
||||
@ -1607,9 +1600,11 @@ public final class Locale implements Cloneable, Serializable {
|
||||
*
|
||||
* <li>The language code "und" is mapped to language "".
|
||||
*
|
||||
* <li>The language codes "he", "yi", and "id" are mapped to "iw",
|
||||
* "ji", and "in" respectively. (This is the same canonicalization
|
||||
* that's done in Locale's constructors.)
|
||||
* <li>The language codes "iw", "ji", and "in" are mapped to "he",
|
||||
* "yi", and "id" respectively. (This is the same canonicalization
|
||||
* that's done in Locale's constructors.) See
|
||||
* <a href="#legacy_language_codes">Legacy language codes</a>
|
||||
* for more information.
|
||||
*
|
||||
* <li>The portion of a private use subtag prefixed by "lvariant",
|
||||
* if any, is removed and appended to the variant field in the
|
||||
@ -2396,17 +2391,9 @@ public final class Locale implements Cloneable, Serializable {
|
||||
|
||||
private static String convertOldISOCodes(String language) {
|
||||
// we accept both the old and the new ISO codes for the languages whose ISO
|
||||
// codes have changed, but we always store the OLD code, for backward compatibility
|
||||
language = LocaleUtils.toLowerString(language).intern();
|
||||
if (language == "he") {
|
||||
return "iw";
|
||||
} else if (language == "yi") {
|
||||
return "ji";
|
||||
} else if (language == "id") {
|
||||
return "in";
|
||||
} else {
|
||||
return language;
|
||||
}
|
||||
// codes have changed, but we always store the NEW code, unless the property
|
||||
// java.locale.useOldISOCodes is set to "true"
|
||||
return BaseLocale.convertOldISOCodes(LocaleUtils.toLowerString(language).intern());
|
||||
}
|
||||
|
||||
private static LocaleExtensions getCompatibilityExtensions(String language,
|
||||
|
@ -72,6 +72,8 @@ import jdk.internal.reflect.Reflection;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.util.locale.BaseLocale;
|
||||
import sun.util.locale.LocaleObjectCache;
|
||||
import sun.util.resources.Bundles;
|
||||
|
||||
import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;
|
||||
|
||||
|
||||
@ -3098,6 +3100,12 @@ public abstract class ResourceBundle {
|
||||
* nor {@code "java.properties"}, an
|
||||
* {@code IllegalArgumentException} is thrown.</li>
|
||||
*
|
||||
* <li>If the {@code locale}'s language is one of the
|
||||
* <a href="./Locale.html#legacy_language_codes">Legacy language
|
||||
* codes</a>, either old or new, then repeat the loading process
|
||||
* if needed, with the bundle name with the other language.
|
||||
* For example, "iw" for "he" and vice versa.
|
||||
*
|
||||
* </ul>
|
||||
*
|
||||
* @param baseName
|
||||
@ -3152,6 +3160,21 @@ public abstract class ResourceBundle {
|
||||
* that is visible to the given loader and accessible to the given caller.
|
||||
*/
|
||||
String bundleName = toBundleName(baseName, locale);
|
||||
var bundle = newBundle0(bundleName, format, loader, reload);
|
||||
if (bundle == null) {
|
||||
// Try loading legacy ISO language's other bundles
|
||||
var otherBundleName = Bundles.toOtherBundleName(baseName, bundleName, locale);
|
||||
if (!bundleName.equals(otherBundleName)) {
|
||||
bundle = newBundle0(otherBundleName, format, loader, reload);
|
||||
}
|
||||
}
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
private ResourceBundle newBundle0(String bundleName, String format,
|
||||
ClassLoader loader, boolean reload)
|
||||
throws IllegalAccessException, InstantiationException, IOException {
|
||||
ResourceBundle bundle = null;
|
||||
if (format.equals("java.class")) {
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -27,6 +27,7 @@ package java.util.spi;
|
||||
|
||||
import jdk.internal.access.JavaUtilResourceBundleAccess;
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
import sun.util.resources.Bundles;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -187,6 +188,17 @@ public abstract class AbstractResourceBundleProvider implements ResourceBundlePr
|
||||
public ResourceBundle getBundle(String baseName, Locale locale) {
|
||||
Module module = this.getClass().getModule();
|
||||
String bundleName = toBundleName(baseName, locale);
|
||||
var bundle = getBundle0(module, bundleName);
|
||||
if (bundle == null) {
|
||||
var otherBundleName = Bundles.toOtherBundleName(baseName, bundleName, locale);
|
||||
if (!bundleName.equals(otherBundleName)) {
|
||||
bundle = getBundle0(module, Bundles.toOtherBundleName(baseName, bundleName, locale));
|
||||
}
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
|
||||
private ResourceBundle getBundle0(Module module, String bundleName) {
|
||||
ResourceBundle bundle = null;
|
||||
|
||||
for (String format : formats) {
|
||||
|
@ -34,6 +34,7 @@ package sun.util.locale;
|
||||
|
||||
import jdk.internal.misc.CDS;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.StringJoiner;
|
||||
@ -98,6 +99,13 @@ public final class BaseLocale {
|
||||
|
||||
private volatile int hash;
|
||||
|
||||
/**
|
||||
* Boolean for the old ISO language code compatibility.
|
||||
*/
|
||||
private static final boolean OLD_ISO_CODES = GetPropertyAction.privilegedGetProperties()
|
||||
.getProperty("java.locale.useOldISOCodes", "false")
|
||||
.equalsIgnoreCase("true");
|
||||
|
||||
// This method must be called with normalize = false only when creating the
|
||||
// Locale.* constants and non-normalized BaseLocale$Keys used for lookup.
|
||||
private BaseLocale(String language, String script, String region, String variant,
|
||||
@ -153,19 +161,22 @@ public final class BaseLocale {
|
||||
|
||||
// JDK uses deprecated ISO639.1 language codes for he, yi and id
|
||||
if (!language.isEmpty()) {
|
||||
if (language.equals("he")) {
|
||||
language = "iw";
|
||||
} else if (language.equals("yi")) {
|
||||
language = "ji";
|
||||
} else if (language.equals("id")) {
|
||||
language = "in";
|
||||
}
|
||||
language = convertOldISOCodes(language);
|
||||
}
|
||||
|
||||
Key key = new Key(language, script, region, variant, false);
|
||||
return Cache.CACHE.get(key);
|
||||
}
|
||||
|
||||
public static String convertOldISOCodes(String language) {
|
||||
return switch (language) {
|
||||
case "he", "iw" -> OLD_ISO_CODES ? "iw" : "he";
|
||||
case "id", "in" -> OLD_ISO_CODES ? "in" : "id";
|
||||
case "yi", "ji" -> OLD_ISO_CODES ? "ji" : "yi";
|
||||
default -> language;
|
||||
};
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -208,6 +208,17 @@ public abstract class Bundles {
|
||||
Class<ResourceBundle> bundleClass = (Class<ResourceBundle>) c;
|
||||
bundle = bundleAccess.newResourceBundle(bundleClass);
|
||||
}
|
||||
if (bundle == null) {
|
||||
var otherBundleName = toOtherBundleName(baseName, bundleName, targetLocale);
|
||||
if (!bundleName.equals(otherBundleName)) {
|
||||
c = Class.forName(Bundles.class.getModule(), otherBundleName);
|
||||
if (c != null && ResourceBundle.class.isAssignableFrom(c)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<ResourceBundle> bundleClass = (Class<ResourceBundle>) c;
|
||||
bundle = bundleAccess.newResourceBundle(bundleClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
cacheKey.setCause(e);
|
||||
}
|
||||
@ -345,27 +356,55 @@ public abstract class Bundles {
|
||||
return bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the other bundle name for languages that have changed,
|
||||
* i.e. "he", "id", and "yi"
|
||||
*
|
||||
* @param baseName ResourceBundle base name
|
||||
* @param bundleName ResourceBundle bundle name
|
||||
* @param locale locale
|
||||
* @return the other bundle name, or the same name for non-legacy ISO languages
|
||||
*/
|
||||
public static String toOtherBundleName(String baseName, String bundleName, Locale locale) {
|
||||
var simpleName= baseName.substring(baseName.lastIndexOf('.') + 1);
|
||||
var suffix = bundleName.substring(bundleName.lastIndexOf(simpleName) + simpleName.length());
|
||||
var otherSuffix = switch(locale.getLanguage()) {
|
||||
case "he" -> suffix.replaceFirst("^_he(_.*)?$", "_iw$1");
|
||||
case "id" -> suffix.replaceFirst("^_id(_.*)?$", "_in$1");
|
||||
case "yi" -> suffix.replaceFirst("^_yi(_.*)?$", "_ji$1");
|
||||
case "iw" -> suffix.replaceFirst("^_iw(_.*)?$", "_he$1");
|
||||
case "in" -> suffix.replaceFirst("^_in(_.*)?$", "_id$1");
|
||||
case "ji" -> suffix.replaceFirst("^_ji(_.*)?$", "_yi$1");
|
||||
default -> suffix;
|
||||
};
|
||||
|
||||
if (suffix.equals(otherSuffix)) {
|
||||
return bundleName;
|
||||
} else {
|
||||
return bundleName.substring(0, bundleName.lastIndexOf(suffix)) + otherSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Strategy interface defines methods that are called by Bundles.of during
|
||||
* the resource bundle loading process.
|
||||
*/
|
||||
public static interface Strategy {
|
||||
public interface Strategy {
|
||||
/**
|
||||
* Returns a list of locales to be looked up for bundle loading.
|
||||
*/
|
||||
public List<Locale> getCandidateLocales(String baseName, Locale locale);
|
||||
List<Locale> getCandidateLocales(String baseName, Locale locale);
|
||||
|
||||
/**
|
||||
* Returns the bundle name for the given baseName and locale.
|
||||
*/
|
||||
public String toBundleName(String baseName, Locale locale);
|
||||
String toBundleName(String baseName, Locale locale);
|
||||
|
||||
/**
|
||||
* Returns the service provider type for the given baseName
|
||||
* and locale, or null if no service providers should be used.
|
||||
*/
|
||||
public Class<? extends ResourceBundleProvider> getResourceBundleProviderType(String baseName,
|
||||
Class<? extends ResourceBundleProvider> getResourceBundleProviderType(String baseName,
|
||||
Locale locale);
|
||||
}
|
||||
|
||||
@ -374,7 +413,7 @@ public abstract class Bundles {
|
||||
* BundleReference.
|
||||
*/
|
||||
private static interface CacheKeyReference {
|
||||
public CacheKey getCacheKey();
|
||||
CacheKey getCacheKey();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -216,6 +216,13 @@ public class LocaleData {
|
||||
protected String toBundleName(String baseName, Locale locale) {
|
||||
return LocaleDataStrategy.INSTANCE.toBundleName(baseName, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the other bundle name for legacy ISO 639 languages.
|
||||
*/
|
||||
protected String toOtherBundleName(String baseName, String bundleName, Locale locale) {
|
||||
return Bundles.toOtherBundleName(baseName, bundleName, locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,14 +158,10 @@ public final class ComponentOrientation implements java.io.Serializable
|
||||
// to find the appropriate orientation. Until pluggable locales
|
||||
// are introduced however, the flexibility isn't really needed.
|
||||
// So we choose efficiency instead.
|
||||
String lang = locale.getLanguage();
|
||||
if( "iw".equals(lang) || "ar".equals(lang)
|
||||
|| "fa".equals(lang) || "ur".equals(lang) )
|
||||
{
|
||||
return RIGHT_TO_LEFT;
|
||||
} else {
|
||||
return LEFT_TO_RIGHT;
|
||||
}
|
||||
return switch (locale.getLanguage()) {
|
||||
case "ar", "fa", "he", "iw", "ji", "ur", "yi" -> RIGHT_TO_LEFT;
|
||||
default -> LEFT_TO_RIGHT;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ package sun.text.resources.ext;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class CollationData_iw extends ListResourceBundle {
|
||||
public class CollationData_he extends ListResourceBundle {
|
||||
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
@ -78,7 +78,7 @@ package sun.text.resources.ext;
|
||||
|
||||
import sun.util.resources.ParallelListResourceBundle;
|
||||
|
||||
public class FormatData_iw extends ParallelListResourceBundle {
|
||||
public class FormatData_he extends ParallelListResourceBundle {
|
||||
/**
|
||||
* Overrides ParallelListResourceBundle
|
||||
*/
|
@ -42,7 +42,7 @@ package sun.text.resources.ext;
|
||||
|
||||
import sun.util.resources.ParallelListResourceBundle;
|
||||
|
||||
public class FormatData_iw_IL extends ParallelListResourceBundle {
|
||||
public class FormatData_he_IL extends ParallelListResourceBundle {
|
||||
/**
|
||||
* Overrides ParallelListResourceBundle
|
||||
*/
|
@ -63,7 +63,7 @@ package sun.text.resources.ext;
|
||||
|
||||
import sun.util.resources.ParallelListResourceBundle;
|
||||
|
||||
public class FormatData_in extends ParallelListResourceBundle {
|
||||
public class FormatData_id extends ParallelListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "MonthNames",
|
@ -63,7 +63,7 @@ package sun.text.resources.ext;
|
||||
|
||||
import sun.util.resources.ParallelListResourceBundle;
|
||||
|
||||
public class FormatData_in_ID extends ParallelListResourceBundle {
|
||||
public class FormatData_id_ID extends ParallelListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "TimePatterns",
|
@ -69,7 +69,7 @@ package sun.text.resources.ext;
|
||||
|
||||
import sun.util.resources.OpenListResourceBundle;
|
||||
|
||||
public class JavaTimeSupplementary_iw extends OpenListResourceBundle {
|
||||
public class JavaTimeSupplementary_he extends OpenListResourceBundle {
|
||||
@Override
|
||||
protected final Object[][] getContents() {
|
||||
final String[] sharedQuarterNames = {
|
@ -69,7 +69,7 @@ package sun.text.resources.ext;
|
||||
|
||||
import sun.util.resources.OpenListResourceBundle;
|
||||
|
||||
public class JavaTimeSupplementary_in extends OpenListResourceBundle {
|
||||
public class JavaTimeSupplementary_id extends OpenListResourceBundle {
|
||||
@Override
|
||||
protected final Object[][] getContents() {
|
||||
final String[] sharedQuarterAbbreviations = {
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -36,7 +36,15 @@ import sun.util.resources.LocaleData;
|
||||
public class LocaleDataProvider extends LocaleData.CommonResourceBundleProvider {
|
||||
@Override
|
||||
public ResourceBundle getBundle(String baseName, Locale locale) {
|
||||
return loadResourceBundle(toBundleName(baseName, locale));
|
||||
var bundleName = toBundleName(baseName, locale);
|
||||
var rb = loadResourceBundle(bundleName);
|
||||
if (rb == null) {
|
||||
var otherBundleName = toOtherBundleName(baseName, bundleName, locale);
|
||||
if (!bundleName.equals(otherBundleName)) {
|
||||
rb = loadResourceBundle(otherBundleName);
|
||||
}
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -35,6 +35,14 @@ import sun.util.resources.LocaleData;
|
||||
public class SupplementaryLocaleDataProvider extends LocaleData.SupplementaryResourceBundleProvider {
|
||||
@Override
|
||||
public ResourceBundle getBundle(String baseName, Locale locale) {
|
||||
return LocaleDataProvider.loadResourceBundle(toBundleName(baseName, locale));
|
||||
var bundleName = toBundleName(baseName, locale);
|
||||
var rb = LocaleDataProvider.loadResourceBundle(bundleName);
|
||||
if (rb == null) {
|
||||
var otherBundleName = toOtherBundleName(baseName, bundleName, locale);
|
||||
if (!bundleName.equals(otherBundleName)) {
|
||||
rb = LocaleDataProvider.loadResourceBundle(otherBundleName);
|
||||
}
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4108453 4778440 6304780 6396378
|
||||
* @bug 4108453 4778440 6304780 6396378 8263202
|
||||
* @summary Basic tests for java.awt.ComponentOrientation
|
||||
* @build TestBundle TestBundle_es TestBundle_iw
|
||||
* @build TestBundle1 TestBundle1_ar
|
||||
@ -100,6 +100,12 @@ public class BasicTest {
|
||||
orient = ComponentOrientation.getOrientation(new Locale("ar", ""));
|
||||
Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT");
|
||||
|
||||
orient = ComponentOrientation.getOrientation(new Locale("he", ""));
|
||||
Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "he == RIGHT_TO_LEFT");
|
||||
|
||||
orient = ComponentOrientation.getOrientation(new Locale("yi", ""));
|
||||
Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "yi == RIGHT_TO_LEFT");
|
||||
|
||||
System.out.println(" } Pass");
|
||||
}
|
||||
|
||||
@ -130,6 +136,10 @@ public class BasicTest {
|
||||
rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", "IL"));
|
||||
assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT" );
|
||||
|
||||
// Test with "he" locale. This should load TestBundle_iw and fetch the orientation from there
|
||||
rb = ResourceBundle.getBundle("TestBundle", new Locale("he", "IL"));
|
||||
assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "he == RIGHT_TO_LEFT" );
|
||||
|
||||
// This bundle has no orientation setting at all, so we should get
|
||||
// the system's default orientation for Arabic
|
||||
rb = ResourceBundle.getBundle("TestBundle1", new Locale("ar", ""));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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
|
||||
@ -44,7 +44,7 @@ import java.util.Set;
|
||||
/**
|
||||
* @test
|
||||
* @bug 6875847 6992272 7002320 7015500 7023613 7032820 7033504 7004603
|
||||
* 7044019 8008577 8176853 8255086
|
||||
* 7044019 8008577 8176853 8255086 8263202
|
||||
* @summary test API changes to Locale
|
||||
* @library /java/text/testlib
|
||||
* @modules jdk.localedata
|
||||
@ -292,12 +292,12 @@ public class LocaleEnhanceTest extends IntlTest {
|
||||
{ "xXxXxXxXxXxX", "yYyYyYyYyYyYyYyY", "zZzZzZzZzZzZzZzZ",
|
||||
"xxxxxxxxxxxx", "YYYYYYYYYYYYYYYY" },
|
||||
// mapped language ids
|
||||
{ "he", "IW", "", "iw" },
|
||||
{ "iw", "IW", "", "iw" },
|
||||
{ "yi", "DE", "", "ji" },
|
||||
{ "ji", "DE", "", "ji" },
|
||||
{ "id", "ID", "", "in" },
|
||||
{ "in", "ID", "", "in" },
|
||||
{ "he", "IL", "", "he" },
|
||||
{ "iw", "IL", "", "he" },
|
||||
{ "yi", "DE", "", "yi" },
|
||||
{ "ji", "DE", "", "yi" },
|
||||
{ "id", "ID", "", "id" },
|
||||
{ "in", "ID", "", "id" },
|
||||
// special variants
|
||||
{ "ja", "JP", "JP" },
|
||||
{ "th", "TH", "TH" },
|
||||
@ -467,8 +467,8 @@ public class LocaleEnhanceTest extends IntlTest {
|
||||
// three-letter language tags are not canonicalized
|
||||
{ "Eng", "", "", "eng" },
|
||||
// legacy languages canonicalize to modern equivalents
|
||||
{ "he", "IW", "", "he-IW" },
|
||||
{ "iw", "IW", "", "he-IW" },
|
||||
{ "he", "IL", "", "he-IL" },
|
||||
{ "iw", "IL", "", "he-IL" },
|
||||
{ "yi", "DE", "", "yi-DE" },
|
||||
{ "ji", "DE", "", "yi-DE" },
|
||||
{ "id", "ID", "", "id-ID" },
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -25,11 +25,12 @@
|
||||
* @bug 4052404 4052440 4084688 4092475 4101316 4105828 4107014 4107953 4110613
|
||||
* 4118587 4118595 4122371 4126371 4126880 4135316 4135752 4139504 4139940 4143951
|
||||
* 4147315 4147317 4147552 4335196 4778440 4940539 5010672 6475525 6544471 6627549
|
||||
* 6786276 7066203 7085757 8008577 8030696 8170840 8255086
|
||||
* 6786276 7066203 7085757 8008577 8030696 8170840 8255086 8263202
|
||||
* @summary test Locales
|
||||
* @library /java/text/testlib
|
||||
* @modules jdk.localedata
|
||||
* @run main/othervm -Djava.locale.providers=JRE,SPI LocaleTest
|
||||
* @run main/othervm -Djava.locale.providers=COMPAT,SPI LocaleTest
|
||||
* @run main/othervm -Djava.locale.providers=COMPAT,SPI -Djava.locale.useOldISOCodes=true LocaleTest
|
||||
*/
|
||||
/*
|
||||
*
|
||||
@ -677,7 +678,7 @@ test commented out pending API-change approval
|
||||
}
|
||||
|
||||
/**
|
||||
* @bug 4052404 4778440
|
||||
* @bug 4052404 4778440 8263202
|
||||
*/
|
||||
public void TestChangedISO639Codes() {
|
||||
Locale hebrewOld = new Locale("iw", "IL", "");
|
||||
@ -687,18 +688,34 @@ test commented out pending API-change approval
|
||||
Locale indonesianOld = new Locale("in", "", "");
|
||||
Locale indonesianNew = new Locale("id", "", "");
|
||||
|
||||
if (!hebrewNew.getLanguage().equals("iw")) {
|
||||
errln("Got back wrong language code for Hebrew: expected \"iw\", got \""
|
||||
+ hebrewNew.getLanguage() + "\"");
|
||||
}
|
||||
if (!yiddishNew.getLanguage().equals("ji")) {
|
||||
errln("Got back wrong language code for Yiddish: expected \"ji\", got \""
|
||||
+ yiddishNew.getLanguage() + "\"");
|
||||
}
|
||||
if (!indonesianNew.getLanguage().equals("in")) {
|
||||
errln("Got back wrong language code for Indonesian: expected \"in\", got \""
|
||||
+ indonesianNew.getLanguage() + "\"");
|
||||
if ("true".equalsIgnoreCase(System.getProperty("java.locale.useOldISOCodes"))) {
|
||||
if (!hebrewNew.getLanguage().equals("iw")) {
|
||||
errln("Got back wrong language code for new Hebrew: expected \"iw\", got \""
|
||||
+ hebrewNew.getLanguage() + "\"");
|
||||
}
|
||||
if (!yiddishNew.getLanguage().equals("ji")) {
|
||||
errln("Got back wrong language code for new Yiddish: expected \"ji\", got \""
|
||||
+ yiddishNew.getLanguage() + "\"");
|
||||
}
|
||||
if (!indonesianNew.getLanguage().equals("in")) {
|
||||
errln("Got back wrong language code for new Indonesian: expected \"in\", got \""
|
||||
+ indonesianNew.getLanguage() + "\"");
|
||||
}
|
||||
} else {
|
||||
if (!hebrewOld.getLanguage().equals("he")) {
|
||||
errln("Got back wrong language code for old Hebrew: expected \"he\", got \""
|
||||
+ hebrewNew.getLanguage() + "\"");
|
||||
}
|
||||
if (!yiddishOld.getLanguage().equals("yi")) {
|
||||
errln("Got back wrong language code for old Yiddish: expected \"yi\", got \""
|
||||
+ yiddishNew.getLanguage() + "\"");
|
||||
}
|
||||
if (!indonesianOld.getLanguage().equals("id")) {
|
||||
errln("Got back wrong language code for old Indonesian: expected \"id\", got \""
|
||||
+ indonesianNew.getLanguage() + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -188,4 +188,31 @@ public class ModuleTestUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the module test with "useOldISOCodes=true".
|
||||
*
|
||||
* @param mp module path
|
||||
* @param mn module name
|
||||
* @param localeList locale list
|
||||
*/
|
||||
public static void runModuleWithLegacyCode(String mp, String mn, List<String> localeList)
|
||||
throws Throwable {
|
||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
||||
launcher.addToolArg("-ea")
|
||||
.addToolArg("-esa")
|
||||
.addToolArg("-Djava.locale.useOldISOCodes=true")
|
||||
.addToolArg("-p")
|
||||
.addToolArg(mp)
|
||||
.addToolArg("-m")
|
||||
.addToolArg(mn);
|
||||
localeList.forEach(launcher::addToolArg);
|
||||
|
||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
||||
.getExitValue();
|
||||
if (exitCode != 0) {
|
||||
throw new RuntimeException("Execution of the test failed. "
|
||||
+ "Unexpected exit code: " + exitCode);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8044767 8139067 8210408
|
||||
* @bug 8044767 8139067 8210408 8263202
|
||||
* @summary Basic tests for ResourceBundle with modules:
|
||||
* 1) Named module "test" contains resource bundles for root and en,
|
||||
* and separate named modules "eubundles" and "asiabundles" contain
|
||||
@ -82,7 +82,7 @@ public class BasicTest {
|
||||
private static final List<String> LOCALE_LIST = List.of("de", "fr", "ja",
|
||||
"zh-tw", "en", "de");
|
||||
private static final List<String> LOCALE_LIST_BASIC = List.of("de", "fr",
|
||||
"ja", "ja-jp", "zh-tw", "en", "de", "ja-jp");
|
||||
"ja", "ja-jp", "zh-tw", "en", "de", "ja-jp", "in", "yi");
|
||||
|
||||
private static final List<String> MODULE_LIST = List.of("asiabundles",
|
||||
"eubundles", "test");
|
||||
@ -130,6 +130,7 @@ public class BasicTest {
|
||||
moduleList.forEach(mn -> ModuleTestUtil.prepareModule(srcPath, modPath,
|
||||
mn, resFormat));
|
||||
ModuleTestUtil.runModule(modPath.toString(), MAIN, localeList);
|
||||
ModuleTestUtil.runModuleWithLegacyCode(modPath.toString(), MAIN, localeList);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -33,6 +33,6 @@ public class MyResourcesAsia extends MyResourcesProvider {
|
||||
public MyResourcesAsia() {
|
||||
super("java.properties", "asia",
|
||||
Locale.JAPANESE, Locale.JAPAN, Locale.CHINESE, Locale.TAIWAN,
|
||||
new Locale("vi"));
|
||||
new Locale("vi"), new Locale("in"));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
#
|
||||
# Copyright (c) 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
key=id: message
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -32,6 +32,6 @@ import jdk.test.resources.spi.MyResourcesProvider;
|
||||
public class MyResourcesEU extends MyResourcesProvider {
|
||||
public MyResourcesEU() {
|
||||
super("java.class", "eu",
|
||||
Locale.GERMAN, Locale.FRENCH, new Locale("es"));
|
||||
Locale.GERMAN, Locale.FRENCH, new Locale("es"), new Locale("yi"));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package jdk.test.resources.eu;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class MyResources_ji extends ListResourceBundle {
|
||||
@Override
|
||||
public Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
// returned value is compared with Locale.toLanguageTag()
|
||||
// which always returns NEW code
|
||||
{ "key", "yi: message" }
|
||||
};
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -39,7 +39,7 @@ public class Main {
|
||||
locale);
|
||||
String tag = locale.toLanguageTag(); // normalized
|
||||
String value = rb.getString("key");
|
||||
System.out.println("locale = " + tag + ", value = " + value);
|
||||
System.out.println("locale = " + locale + ", value = " + value);
|
||||
if (!value.startsWith(tag + ':')) {
|
||||
errors++;
|
||||
}
|
||||
|
@ -377,13 +377,13 @@ public class IncludeLocalesPluginTest {
|
||||
"--include-locales=he,id,yi",
|
||||
"jdk.localedata",
|
||||
List.of(
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_in.class",
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_in_ID.class",
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_iw.class",
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_iw_IL.class",
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_in.class",
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_iw.class",
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ji.class"),
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_he.class",
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_he_IL.class",
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_id.class",
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_id_ID.class",
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_he.class",
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_id.class",
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_yi.class"),
|
||||
List.of(
|
||||
"/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
|
||||
"/jdk.localedata/sun/text/resources/ext/thai_dict",
|
||||
@ -396,8 +396,8 @@ public class IncludeLocalesPluginTest {
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
|
||||
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
|
||||
List.of(
|
||||
"(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "in", "in_ID",
|
||||
"in_ID_#Latn", "iw", "iw_IL", "iw_IL_#Hebr", "ji", "ji_001", "ji_001_#Hebr"),
|
||||
"(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "id", "id_ID",
|
||||
"id_ID_#Latn", "he", "he_IL", "he_IL_#Hebr", "yi", "yi_001", "yi_001_#Hebr"),
|
||||
"",
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user