diff options
author | Victor Chang <vichang@google.com> | 2021-01-19 10:17:23 +0000 |
---|---|---|
committer | Victor Chang <vichang@google.com> | 2022-11-14 15:45:43 +0000 |
commit | 30180392ce83eb43e8b4c1dec4392d3b6a88e8ad (patch) | |
tree | 4cf3ad8870f5fc170cf0dbcb0fd3325fe5f1c791 /icu4j | |
parent | a7bcc8b59a2da3df70dc4ce9d54f361368a220c7 (diff) | |
download | icu-30180392ce83eb43e8b4c1dec4392d3b6a88e8ad.tar.gz |
Android patch: CLDR data: Force default Gregorian calendar.
This change was introduced in Android by this patch:
https://android.googlesource.com/platform/external/icu/+/b844b3e
And then amended by the ICU 52 upgrade:
https://android.googlesource.com/platform/external/icu/+/59d709d
And then amended for ICU 55:
https://android.googlesource.com/platform/external/icu/+/fafa8ad
And then amended for ICU 58:
https://android.googlesource.com/platform/external/icu/+/047edd2
And then amended for ICU 64, updating test expectaiotns for
DateIntervalFormatTest and removing obsolete th_TH_TRADIOTIONAL locale
from IBMCalendarTest since it is now equivalent to th_TH.
Amended in ICU 69 by adding a new patch on ICU4C tests from Android S:
https://r.android.com/1640799
Amended in ICU 70 to update the formatted string in dtfmtst.cpp
The patch in ICU 69 can be found at https://r.android.com/1802266
Test: n/a
Change-Id: Ib3c25e0d443ea2ad5d06eeb91c0f9d0a0261b792
Diffstat (limited to 'icu4j')
4 files changed, 54 insertions, 37 deletions
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java index 1d21f0633..717141fb6 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java @@ -2150,32 +2150,36 @@ public class CalendarRegressionTest extends com.ibm.icu.dev.test.TestFmwk { Locale loc = new Locale("en", "TH"); Calendar cal = Calendar.getInstance(loc); String calType = cal.getType(); - if ( !calType.equals("buddhist")) { - errln("FAIL: Calendar type for en_TH should still be buddhist"); + // Android patch: Force default Gregorian calendar. + if ( !calType.equals("gregorian")) { + errln("FAIL: Calendar type for en_TH should still be gregorian"); } + // Android patch end. } @Test public void TestGetKeywordValuesForLocale(){ + // Android patch: Force default Gregorian calendar. final String[][] PREFERRED = { {"root", "gregorian"}, {"und", "gregorian"}, {"en_US", "gregorian"}, {"en_029", "gregorian"}, - {"th_TH", "buddhist", "gregorian"}, - {"und_TH", "buddhist", "gregorian"}, - {"en_TH", "buddhist", "gregorian"}, + {"th_TH", "gregorian", "buddhist"}, + {"und_TH", "gregorian", "buddhist"}, + {"en_TH", "gregorian", "buddhist"}, {"he_IL", "gregorian", "hebrew", "islamic", "islamic-civil", "islamic-tbla"}, {"ar_EG", "gregorian", "coptic", "islamic", "islamic-civil", "islamic-tbla"}, {"ja", "gregorian", "japanese"}, {"ps_Guru_IN", "gregorian", "indian"}, - {"th@calendar=gregorian", "buddhist", "gregorian"}, + {"th@calendar=gregorian", "gregorian", "buddhist"}, {"en@calendar=islamic", "gregorian"}, {"zh_TW", "gregorian", "roc", "chinese"}, - {"ar_IR", "persian", "gregorian", "islamic", "islamic-civil", "islamic-tbla"}, - {"th@rg=SAZZZZ", "islamic-umalqura", "gregorian", "islamic", "islamic-rgsa"}, + {"ar_IR", "gregorian", "persian", "islamic", "islamic-civil", "islamic-tbla"}, + {"th@rg=SAZZZZ", "gregorian", "islamic-umalqura", "islamic", "islamic-rgsa"}, }; + // Android patch end. String[] ALL = Calendar.getKeywordValuesForLocale("calendar", ULocale.getDefault(), false); HashSet ALLSET = new HashSet(); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IBMCalendarTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IBMCalendarTest.java index 0e58f9d23..f3e3bb806 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IBMCalendarTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/IBMCalendarTest.java @@ -335,9 +335,11 @@ public class IBMCalendarTest extends CalendarTestFmwk { // Thai locale Calendar cal = Calendar.getInstance(new ULocale("th_TH")); String type = cal.getType(); - if (!type.equals("buddhist")) { - errln("FAIL: Buddhist calendar is not returned for locale " + cal.toString()); + // Android patch: Force default Gregorian calendar. + if (!type.equals("gregorian")) { + errln("FAIL: Gregorian calendar is not returned for locale " + cal.toString()); } + // Android patch end. } /** @@ -1104,6 +1106,7 @@ public class IBMCalendarTest extends CalendarTestFmwk { "th@rg=SA", // ignore malformed rg tag, use buddhist }; + // Android patch: Force default Gregorian calendar. String[] types = { "gregorian", "japanese", @@ -1111,20 +1114,21 @@ public class IBMCalendarTest extends CalendarTestFmwk { "japanese", "buddhist", "gregorian", - "buddhist", "gregorian", "gregorian", - "buddhist", - "buddhist", - "buddhist", + "gregorian", + "gregorian", + "gregorian", + "gregorian", "gregorian", // iso8601 is a gregorian sub type "gregorian", - "islamic-umalqura", - "islamic-umalqura", + "gregorian", + "gregorian", "japanese", - "buddhist", - "buddhist", + "gregorian", + "gregorian", }; + // Android patch end. for (int i = 0; i < locs.length; i++) { Calendar cal = Calendar.getInstance(new ULocale(locs[i])); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java index 5902f7fa5..b6446210a 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java @@ -652,48 +652,54 @@ public class DateIntervalFormatTest extends TestFmwk { // Thai (default calendar buddhist) - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. 2550 \\u2013 \\u0E27\\u0E31\\u0E19\\u0E28\\u0E38\\u0E01\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. 2551", + // Android patch: Force default Gregorian calendar. + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. 2550 \\u2013 \\u0E27\\u0E31\\u0E19\\u0E2D\\u0E32\\u0E17\\u0E34\\u0E15\\u0E22\\u0E4C\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. 2551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. 2550 \\u2013 10 \\u0E15.\\u0E04. 2551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "MMMy", "\\u0E15.\\u0E04. 2550 \\u2013 \\u0E15.\\u0E04. 2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. 2550 \\u2013 10 \\u0E15.\\u0E04. 2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "MMMy", "\\u0E15.\\u0E04. 2550 \\u2013 \\u0E15.\\u0E04. 2551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "EdMy", "\\u0E1E. 10/10/2550 \\u2013 \\u0E28. 10/10/2551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "dMy", "10/10/2550 \\u2013 10/10/2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdMy", "ส. 10/10/2550 – อา. 10/10/2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "dMy", "10/10/2550 \\u2013 10/10/2551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "My", "10/2550 \\u2013 10/2551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "EdM", "\\u0E1E. 10/10/2550 \\u2013 \\u0E28. 10/10/2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdMy", "\\u0E2A. 10/10/2550 \\u2013 \\u0E2D\\u0E32. 10/10/2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "My", "10/2550 \\u2013 10/2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdM", "ส. 10/10/2550 – อา. 10/10/2551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "y", "2550\\u20132551", - "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "M", "10/2550 \\u2013 10/2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "y", "2550\\u20132551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdM", "\\u0E2A. 10/10/2550 \\u2013 \\u0E2D\\u0E32. 10/10/2551", + "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "M", "10/2550 \\u2013 10/2551", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. \\u2013 \\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48 10 \\u0E1E.\\u0E22. 2550", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "EEEEdMMMy", "วันเสาร์ที่ 10 ต.ค. – วันอังคารที่ 10 พ.ย. 2550", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. \\u2013 10 \\u0E1E.\\u0E22.", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "MMMy", "\\u0E15.\\u0E04.\\u2013\\u0E1E.\\u0E22. 2550", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. \\u2013 10 \\u0E1E.\\u0E22.", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "dM", "10/10 \\u2013 10/11", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. \\u2013 \\u0E27\\u0E31\\u0E19\\u0E2D\\u0E31\\u0E07\\u0E04\\u0E32\\u0E23\\u0E17\\u0E35\\u0E48 10 \\u0E1E.\\u0E22. 2550", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "MMMy", "\\u0E15.\\u0E04.\\u2013\\u0E1E.\\u0E22. 2550", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "My", "10/2550 \\u2013 11/2550", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "dM", "10/10 \\u2013 10/11", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "My", "10/2550 \\u2013 11/2550", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "d", "10/10 \\u2013 10/11", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "y", "\u0E1E.\u0E28. 2550", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "d", "10/10 \\u2013 10/11", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "y", "2550", - "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "MMM", "\u0E15.\u0E04.\u2013\u0E1E.\u0E22.", + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "MMM", "ต.ค. – พ.ย.", + + "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "y", "2550", // Tests for Japanese calendar with eras, including new era in 2019 (Heisei 31 through April 30, then new era) "en-u-ca-japanese", "H 31 03 15 09:00:00", "H 31 04 15 09:00:00", "GyMMMd", "Mar 15\u2009\u2013\u2009Apr 15, 31 Heisei", @@ -719,6 +725,7 @@ public class DateIntervalFormatTest extends TestFmwk { "ja-u-ca-japanese", "H 31 04 15 09:00:00", DateFormat.JP_ERA_2019_NARROW+" 1 05 15 09:00:00", "GGGGGyMd", "H31/04/15\uFF5E"+DateFormat.JP_ERA_2019_NARROW+"1/05/15", + // Android patch end. }; expect(DATA, DATA.length); } diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java index f60869b7c..463e953ac 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java @@ -756,6 +756,7 @@ public final class ICUResourceBundleTest extends TestFmwk { @Test public void TestFunctionalEquivalent(){ + // Android patch: Force default Gregorian calendar. String[] calCases = { // avail locale equiv "t", "en_US_POSIX", "en@calendar=gregorian", @@ -763,10 +764,11 @@ public final class ICUResourceBundleTest extends TestFmwk { "f", "ja_JP_TOKYO@calendar=japanese", "ja@calendar=japanese", "t", "sr@calendar=gregorian", "sr@calendar=gregorian", "t", "en", "en@calendar=gregorian", - "t", "th_TH", "th@calendar=buddhist", + "t", "th_TH", "th@calendar=gregorian", "t", "th_TH@calendar=gregorian", "th@calendar=gregorian", - "f", "th_TH_Bangkok", "th@calendar=buddhist", + "f", "th_TH_Bangkok", "th@calendar=gregorian", }; + // Android patch end. logln("Testing functional equivalents for calendar..."); getFunctionalEquivalentTestCases(ICUData.ICU_BASE_NAME, |