summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chang <vichang@google.com>2021-01-19 10:18:33 +0000
committerVictor Chang <vichang@google.com>2024-04-19 12:16:35 +0100
commit298b8d7dfaaa1c2353dda619a18856c3d74e890f (patch)
tree11692879a0c6c994eee9a8405685e1b94a64d2d2
parentc12deabf8e3fad084cb2047d2351bf1aa9d375af (diff)
downloadicu-298b8d7dfaaa1c2353dda619a18856c3d74e890f.tar.gz
Android patch: Add DecimalFormatSymbols#getLocalizedPatternSeparator for libcore bridge
The patch was modified in ICU 70 to increase the index. The patch for ICU 69 can be found at https://r.android.com/c/1802386/1 Bug: 144560585 Test: m droid Change-Id: I92788ff37511e68c517ce9d2cf8ad098932cf937
-rw-r--r--icu4j/main/core/src/main/java/com/ibm/icu/text/DecimalFormatSymbols.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/text/DecimalFormatSymbols.java b/icu4j/main/core/src/main/java/com/ibm/icu/text/DecimalFormatSymbols.java
index 726c91c1a..c1d52b0ac 100644
--- a/icu4j/main/core/src/main/java/com/ibm/icu/text/DecimalFormatSymbols.java
+++ b/icu4j/main/core/src/main/java/com/ibm/icu/text/DecimalFormatSymbols.java
@@ -1328,6 +1328,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
"currencyGroup",
"superscriptingExponent",
"approximatelySign",
+ // Android-added: Libcore bridge needs localized pattern separator. http://b/112080617
+ "list",
};
/*
@@ -1406,18 +1408,33 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
}
}
+ // BEGIN Android-added: Libcore bridge needs localized pattern separator. http://b/112080617
/**
- * Initializes the symbols from the locale data.
+ * @internal
*/
- private void initialize(ULocale locale, NumberingSystem ns) {
- this.requestedLocale = locale.toLocale();
- this.ulocale = locale;
+ public static String getLocalizedPatternSeparator(ULocale locale, NumberingSystem ns) {
+ CacheData data = getCachedLocaleData(locale, ns);
+ return data.numberElements[13];
+ }
+ private static CacheData getCachedLocaleData(ULocale locale, NumberingSystem ns) {
// TODO: The cache requires a single key, so we just save the NumberingSystem into the
// locale string. NumberingSystem is then decoded again in the loadData() method. It would
// be more efficient if we didn't have to serialize and deserialize the NumberingSystem.
ULocale keyLocale = (ns == null) ? locale : locale.setKeywordValue("numbers", ns.getName());
- CacheData data = cachedLocaleData.getInstance(keyLocale, null /* unused */);
+ return cachedLocaleData.getInstance(keyLocale, null /* unused */);
+ }
+ // END Android-added: Libcore bridge needs localized pattern separator. http://b/112080617
+
+ /**
+ * Initializes the symbols from the locale data.
+ */
+ private void initialize(ULocale locale, NumberingSystem ns) {
+ this.requestedLocale = locale.toLocale();
+ this.ulocale = locale;
+
+ // Android-changed: Libcore bridge needs localized pattern separator. http://b/112080617
+ CacheData data = getCachedLocaleData(locale, ns);
setLocale(data.validLocale, data.validLocale);
setDigitStrings(data.digits);