ICU-20536 Japanese era Reiwa support in ICU4C 60
diff --git a/icu4c/source/data/locales/ar.txt b/icu4c/source/data/locales/ar.txt
index aafe88a..af41175 100644
--- a/icu4c/source/data/locales/ar.txt
+++ b/icu4c/source/data/locales/ar.txt
@@ -1634,6 +1634,7 @@
"تيشو",
"شووا",
"هيسي",
+ "ريوا",
}
}
}
diff --git a/icu4c/source/data/locales/ast.txt b/icu4c/source/data/locales/ast.txt
index d9d5d1e..355dced 100644
--- a/icu4c/source/data/locales/ast.txt
+++ b/icu4c/source/data/locales/ast.txt
@@ -2304,6 +2304,7 @@
"Taishō",
"e. Shōwa",
"Heisei",
+ "Reiwa",
}
narrow{
"Taika",
@@ -2542,6 +2543,7 @@
"T",
"S",
"H",
+ "R",
}
wide{
"Taika (645–650)",
@@ -2780,6 +2782,7 @@
"Taishō",
"era Shōwa",
"Heisei",
+ "Reiwa",
}
}
intervalFormats{
diff --git a/icu4c/source/data/locales/bs_Cyrl.txt b/icu4c/source/data/locales/bs_Cyrl.txt
index 1c6eeb3..7d2533c 100644
--- a/icu4c/source/data/locales/bs_Cyrl.txt
+++ b/icu4c/source/data/locales/bs_Cyrl.txt
@@ -1030,6 +1030,7 @@
"Таишо",
"Шова",
"Хаисеи",
+ "Реива",
}
}
}
diff --git a/icu4c/source/data/locales/cs.txt b/icu4c/source/data/locales/cs.txt
index 6fc8684..08b3df4 100644
--- a/icu4c/source/data/locales/cs.txt
+++ b/icu4c/source/data/locales/cs.txt
@@ -3697,6 +3697,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
narrow{
"Taika (645–650)",
@@ -3935,6 +3936,7 @@
"T",
"S",
"H",
+ "R",
}
wide{
"Taika (645–650)",
@@ -4173,6 +4175,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
intervalFormats{
diff --git a/icu4c/source/data/locales/de.txt b/icu4c/source/data/locales/de.txt
index efd2206..1e12628 100644
--- a/icu4c/source/data/locales/de.txt
+++ b/icu4c/source/data/locales/de.txt
@@ -1601,6 +1601,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/he.txt b/icu4c/source/data/locales/he.txt
index 427dd79..8d5961a 100644
--- a/icu4c/source/data/locales/he.txt
+++ b/icu4c/source/data/locales/he.txt
@@ -1837,6 +1837,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/hi.txt b/icu4c/source/data/locales/hi.txt
index 9af2861..f40f952 100644
--- a/icu4c/source/data/locales/hi.txt
+++ b/icu4c/source/data/locales/hi.txt
@@ -1239,6 +1239,7 @@
"ताईशो",
"शोवा",
"हेईसेई",
+ "रेइवा",
}
}
}
diff --git a/icu4c/source/data/locales/hr.txt b/icu4c/source/data/locales/hr.txt
index 34322a8..044901e 100644
--- a/icu4c/source/data/locales/hr.txt
+++ b/icu4c/source/data/locales/hr.txt
@@ -1567,6 +1567,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/id.txt b/icu4c/source/data/locales/id.txt
index ac9eb42..9bc40be 100644
--- a/icu4c/source/data/locales/id.txt
+++ b/icu4c/source/data/locales/id.txt
@@ -2217,6 +2217,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/ja.txt b/icu4c/source/data/locales/ja.txt
index ab8c0ab..59a8849 100644
--- a/icu4c/source/data/locales/ja.txt
+++ b/icu4c/source/data/locales/ja.txt
@@ -2464,6 +2464,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
narrow{
"大化",
@@ -2702,6 +2703,7 @@
"T",
"S",
"H",
+ "R",
}
}
}
diff --git a/icu4c/source/data/locales/ko.txt b/icu4c/source/data/locales/ko.txt
index df9f96e..98234a8 100644
--- a/icu4c/source/data/locales/ko.txt
+++ b/icu4c/source/data/locales/ko.txt
@@ -1909,6 +1909,7 @@
"다이쇼",
"쇼와",
"헤이세이",
+ "레이와",
}
}
}
diff --git a/icu4c/source/data/locales/lo.txt b/icu4c/source/data/locales/lo.txt
index cf70906..5f34d1a 100644
--- a/icu4c/source/data/locales/lo.txt
+++ b/icu4c/source/data/locales/lo.txt
@@ -1845,6 +1845,7 @@
"ໄຕໂຊ",
"ໂຊວາ",
"ຮີຊີ",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/lt.txt b/icu4c/source/data/locales/lt.txt
index 88f50bf..2846048 100644
--- a/icu4c/source/data/locales/lt.txt
+++ b/icu4c/source/data/locales/lt.txt
@@ -2466,6 +2466,7 @@
"Taišo",
"Šova",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/nb.txt b/icu4c/source/data/locales/nb.txt
index d3a0037..3a20f9b 100644
--- a/icu4c/source/data/locales/nb.txt
+++ b/icu4c/source/data/locales/nb.txt
@@ -5483,6 +5483,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
narrow{
"Taika (645–650)",
@@ -5721,6 +5722,7 @@
"T",
"S",
"H",
+ "R",
}
wide{
"Taika (645–650)",
@@ -5959,6 +5961,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
intervalFormats{
diff --git a/icu4c/source/data/locales/nl.txt b/icu4c/source/data/locales/nl.txt
index 0430a50..378da5b 100644
--- a/icu4c/source/data/locales/nl.txt
+++ b/icu4c/source/data/locales/nl.txt
@@ -4894,6 +4894,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
narrow{
"Taika (645–650)",
@@ -5132,6 +5133,7 @@
"T",
"S",
"H",
+ "R",
}
wide{
"Taika (645–650)",
@@ -5370,6 +5372,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/root.txt b/icu4c/source/data/locales/root.txt
index e419ce9..8dbbee1 100644
--- a/icu4c/source/data/locales/root.txt
+++ b/icu4c/source/data/locales/root.txt
@@ -1713,6 +1713,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
narrow{
"Taika (645–650)",
@@ -1951,6 +1952,7 @@
"T",
"S",
"H",
+ "R",
}
wide:alias{"/LOCALE/calendar/japanese/eras/abbreviated"}
}
diff --git a/icu4c/source/data/locales/ru.txt b/icu4c/source/data/locales/ru.txt
index 3fdd356..f2bbed9 100644
--- a/icu4c/source/data/locales/ru.txt
+++ b/icu4c/source/data/locales/ru.txt
@@ -1837,6 +1837,7 @@
"Эпоха Тайсьо",
"Сьова",
"Эпоха Хэйсэй",
+ "Рэйва",
}
}
}
diff --git a/icu4c/source/data/locales/sr.txt b/icu4c/source/data/locales/sr.txt
index 821d13a..860c491 100644
--- a/icu4c/source/data/locales/sr.txt
+++ b/icu4c/source/data/locales/sr.txt
@@ -1246,6 +1246,7 @@
"Таишо",
"Шова",
"Хаисеи",
+ "Реива",
}
}
}
diff --git a/icu4c/source/data/locales/sr_Latn.txt b/icu4c/source/data/locales/sr_Latn.txt
index 57a1279..8bcc68c 100644
--- a/icu4c/source/data/locales/sr_Latn.txt
+++ b/icu4c/source/data/locales/sr_Latn.txt
@@ -1247,6 +1247,7 @@
"Taišo",
"Šova",
"Haisei",
+ "Reiva",
}
}
}
diff --git a/icu4c/source/data/locales/sv.txt b/icu4c/source/data/locales/sv.txt
index 01debf9..beb77f4 100644
--- a/icu4c/source/data/locales/sv.txt
+++ b/icu4c/source/data/locales/sv.txt
@@ -1630,6 +1630,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/th.txt b/icu4c/source/data/locales/th.txt
index 4794938..19add19 100644
--- a/icu4c/source/data/locales/th.txt
+++ b/icu4c/source/data/locales/th.txt
@@ -2332,6 +2332,7 @@
"ทะอิโช",
"โชวะ",
"เฮเซ",
+ "เรวะ",
}
}
}
diff --git a/icu4c/source/data/locales/yue.txt b/icu4c/source/data/locales/yue.txt
index 74dd462..8d14665 100644
--- a/icu4c/source/data/locales/yue.txt
+++ b/icu4c/source/data/locales/yue.txt
@@ -2394,6 +2394,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
}
}
diff --git a/icu4c/source/data/locales/yue_Hans.txt b/icu4c/source/data/locales/yue_Hans.txt
index b087983..97b6215 100644
--- a/icu4c/source/data/locales/yue_Hans.txt
+++ b/icu4c/source/data/locales/yue_Hans.txt
@@ -2392,6 +2392,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
}
}
diff --git a/icu4c/source/data/locales/zh.txt b/icu4c/source/data/locales/zh.txt
index 6e8013b..f1aeca4 100644
--- a/icu4c/source/data/locales/zh.txt
+++ b/icu4c/source/data/locales/zh.txt
@@ -3403,6 +3403,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
narrow{
"大化(645–650)",
@@ -3641,6 +3642,7 @@
"T",
"S",
"H",
+ "R",
}
wide{
"大化 (645–650)",
@@ -3879,6 +3881,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
}
}
diff --git a/icu4c/source/data/locales/zh_Hant.txt b/icu4c/source/data/locales/zh_Hant.txt
index 5ff361e..f2a61ce 100644
--- a/icu4c/source/data/locales/zh_Hant.txt
+++ b/icu4c/source/data/locales/zh_Hant.txt
@@ -5737,6 +5737,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
narrow{
"大化",
@@ -5975,6 +5976,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
wide{
"大化",
@@ -6213,6 +6215,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
}
intervalFormats{
diff --git a/icu4c/source/i18n/japancal.cpp b/icu4c/source/i18n/japancal.cpp
index 17b4e07..e00489a 100644
--- a/icu4c/source/i18n/japancal.cpp
+++ b/icu4c/source/i18n/japancal.cpp
@@ -276,7 +276,8 @@
{ 1868, 9, 8 }, // Meiji 232
{ 1912, 7, 30 }, // Taisho 233
{ 1926, 12, 25 }, // Showa 234
- { 1989, 1, 8 } // Heisei 235
+ { 1989, 1, 8 }, // Heisei 235
+ { 2019, 5, 1 } // Reiwa 236
};
#define kEraCount UPRV_LENGTHOF(kEraInfo)
diff --git a/icu4c/source/test/intltest/incaltst.cpp b/icu4c/source/test/intltest/incaltst.cpp
index 1e79576..88c98b5 100644
--- a/icu4c/source/test/intltest/incaltst.cpp
+++ b/icu4c/source/test/intltest/incaltst.cpp
@@ -77,6 +77,7 @@
CASE(7,TestPersian);
CASE(8,TestPersianFormat);
CASE(9,TestTaiwan);
+ CASE(10,TestJapaneseHeiseiToReiwa);
default: name = ""; break;
}
}
@@ -626,23 +627,23 @@
// Test simple parse/format with adopt
UDate aDate = 0;
- // Test parse with missing era (should default to current era, heisei)
+ // Test parse with missing era (should default to current era)
// Test parse with incomplete information
logln("Testing parse w/ missing era...");
- SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("y.M.d"), Locale("ja_JP@calendar=japanese"), status);
+ SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("y/M/d"), Locale("ja_JP@calendar=japanese"), status);
CHECK(status, "creating date format instance");
if(!fmt) {
errln("Couldn't create en_US instance");
} else {
UErrorCode s2 = U_ZERO_ERROR;
cal2->clear();
- UnicodeString samplestr("1.1.9");
+ UnicodeString samplestr("1/5/9");
logln(UnicodeString() + "Test Year: " + samplestr);
aDate = fmt->parse(samplestr, s2);
ParsePosition pp=0;
fmt->parse(samplestr, *cal2, pp);
- CHECK(s2, "parsing the 1.1.9 string");
- logln("*cal2 after 119 parse:");
+ CHECK(s2, "parsing the 1/5/9 string");
+ logln("*cal2 after 159 parse:");
str.remove();
fmt2->format(aDate, str);
logln(UnicodeString() + "as Gregorian Calendar: " + str);
@@ -653,7 +654,7 @@
int32_t expectYear = 1;
int32_t expectEra = JapaneseCalendar::getCurrentEra();
if((gotYear!=1) || (gotEra != expectEra)) {
- errln(UnicodeString("parse "+samplestr+" of 'y.m.d' as Japanese Calendar, expected year ") + expectYear +
+ errln(UnicodeString("parse "+samplestr+" of 'y/m/d' as Japanese Calendar, expected year ") + expectYear +
UnicodeString(" and era ") + expectEra +", but got year " + gotYear + " and era " + gotEra + " (Gregorian:" + str +")");
} else {
logln(UnicodeString() + " year: " + gotYear + ", era: " + gotEra);
@@ -666,7 +667,7 @@
// Test simple parse/format with adopt
UDate aDate = 0;
- // Test parse with missing era (should default to current era, heisei)
+ // Test parse with missing era (should default to current era)
// Test parse with incomplete information
logln("Testing parse w/ just year...");
SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("y"), Locale("ja_JP@calendar=japanese"), status);
@@ -678,7 +679,7 @@
cal2->clear();
UnicodeString samplestr("1");
logln(UnicodeString() + "Test Year: " + samplestr);
- aDate = fmt->parse(samplestr, s2);
+ aDate = fmt->parse(samplestr, s2); // Should be parsed as the first day of the current era
ParsePosition pp=0;
fmt->parse(samplestr, *cal2, pp);
CHECK(s2, "parsing the 1 string");
@@ -691,7 +692,7 @@
int32_t gotYear = cal2->get(UCAL_YEAR, s2);
int32_t gotEra = cal2->get(UCAL_ERA, s2);
int32_t expectYear = 1;
- int32_t expectEra = 235; //JapaneseCalendar::kCurrentEra;
+ int32_t expectEra = JapaneseCalendar::getCurrentEra();
if((gotYear!=1) || (gotEra != expectEra)) {
errln(UnicodeString("parse "+samplestr+" of 'y' as Japanese Calendar, expected year ") + expectYear +
UnicodeString(" and era ") + expectEra +", but got year " + gotYear + " and era " + gotEra + " (Gregorian:" + str +")");
@@ -700,13 +701,47 @@
}
delete fmt;
}
- }
+ }
delete cal2;
delete cal;
delete fmt2;
}
+void IntlCalendarTest::TestJapaneseHeiseiToReiwa() {
+ Calendar *cal;
+ UErrorCode status = U_ZERO_ERROR;
+ cal = Calendar::createInstance(status);
+ CHECK(status, UnicodeString("Creating default Gregorian Calendar"));
+ cal->set(2019, UCAL_APRIL, 29);
+
+ DateFormat *jfmt = DateFormat::createDateInstance(DateFormat::LONG, "ja@calendar=japanese");
+ CHECK(status, UnicodeString("Creating date format ja@calendar=japanese"))
+
+ const char* EXPECTED_FORMAT[4] = {
+ "\\u5E73\\u621031\\u5E744\\u670829\\u65E5", // Heisei 31 April 29
+ "\\u5E73\\u621031\\u5E744\\u670830\\u65E5", // Heisei 31 April 30
+ "\\u4EE4\\u548c1\\u5E745\\u67081\\u65E5", // Reiwa 1 May 1
+ "\\u4EE4\\u548c1\\u5E745\\u67082\\u65E5" // Reiwa 1 May 2
+ };
+
+ for (int32_t i = 0; i < 4; i++) {
+ UnicodeString dateStr;
+ UDate d = cal->getTime(status);
+ CHECK(status, UnicodeString("Get test date"));
+ jfmt->format(d, dateStr);
+ UnicodeString expected(UnicodeString(EXPECTED_FORMAT[i], -1, US_INV).unescape());
+ if (expected.compare(dateStr) != 0) {
+ errln(UnicodeString("Formatting year:") + cal->get(UCAL_YEAR, status) + " month:"
+ + cal->get(UCAL_MONTH, status) + " day:" + (cal->get(UCAL_DATE, status) + 1)
+ + " - expected: " + expected + " / actual: " + dateStr);
+ }
+ cal->add(UCAL_DATE, 1, status);
+ CHECK(status, UnicodeString("Add 1 day"));
+ }
+ delete jfmt;
+ delete cal;
+}
diff --git a/icu4c/source/test/intltest/incaltst.h b/icu4c/source/test/intltest/incaltst.h
index 628b6e4..52b121d 100644
--- a/icu4c/source/test/intltest/incaltst.h
+++ b/icu4c/source/test/intltest/incaltst.h
@@ -34,7 +34,8 @@
void TestJapanese(void);
void TestJapaneseFormat(void);
void TestJapanese3860(void);
-
+ void TestJapaneseHeiseiToReiwa(void);
+
void TestPersian(void);
void TestPersianFormat(void);
diff --git a/icu4c/source/test/testdata/format.txt b/icu4c/source/test/testdata/format.txt
index c0364e2..c598ade 100644
--- a/icu4c/source/test/testdata/format.txt
+++ b/icu4c/source/test/testdata/format.txt
@@ -494,35 +494,35 @@
"",
"PATTERN=G y",
"YEAR=8",
- "Heisei 8"
+ "Reiwa 8"
},
{
"en_US@calendar=japanese",
"",
"PATTERN=G yy",
"YEAR=8",
- "Heisei 08"
+ "Reiwa 08"
},
{
"en_US@calendar=japanese",
"",
"PATTERN=G yyy",
"YEAR=8",
- "Heisei 008"
+ "Reiwa 008"
},
{
"en_US@calendar=japanese",
"",
"PATTERN=G yyyy",
"YEAR=8",
- "Heisei 0008"
+ "Reiwa 0008"
},
{
"en_US@calendar=japanese",
"",
"PATTERN=G yyyyy",
"YEAR=8",
- "Heisei 00008"
+ "Reiwa 00008"
},
}
diff --git a/icu4c/source/test/testdata/structLocale.txt b/icu4c/source/test/testdata/structLocale.txt
index bd3d2b9..e6372c3 100644
--- a/icu4c/source/test/testdata/structLocale.txt
+++ b/icu4c/source/test/testdata/structLocale.txt
@@ -25784,6 +25784,7 @@
"",
"",
"",
+ "",
}
wide{
"",
@@ -26022,6 +26023,7 @@
"",
"",
"",
+ "",
}
narrow{
"",
@@ -26260,6 +26262,7 @@
"",
"",
"",
+ "",
}
}
intervalFormats{