ICU-20536 Japanese era Reiwa support in ICU4C 54
diff --git a/icu4c/source/data/locales/ar.txt b/icu4c/source/data/locales/ar.txt
index c6b48de..19af6bd 100644
--- a/icu4c/source/data/locales/ar.txt
+++ b/icu4c/source/data/locales/ar.txt
@@ -1422,6 +1422,7 @@
"تيشو",
"شووا",
"هيسي",
+ "ريوا",
}
}
}
diff --git a/icu4c/source/data/locales/bs_Cyrl.txt b/icu4c/source/data/locales/bs_Cyrl.txt
index 0d64570..fb30a32 100755
--- a/icu4c/source/data/locales/bs_Cyrl.txt
+++ b/icu4c/source/data/locales/bs_Cyrl.txt
@@ -999,6 +999,7 @@
"Таишо",
"Шова",
"Хаисеи",
+ "Реива",
}
}
}
diff --git a/icu4c/source/data/locales/de.txt b/icu4c/source/data/locales/de.txt
index 6e8857a..8a9bc15 100644
--- a/icu4c/source/data/locales/de.txt
+++ b/icu4c/source/data/locales/de.txt
@@ -1066,6 +1066,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/en_AU.txt b/icu4c/source/data/locales/en_AU.txt
index dc3a6c4..1497334 100644
--- a/icu4c/source/data/locales/en_AU.txt
+++ b/icu4c/source/data/locales/en_AU.txt
@@ -541,6 +541,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/en_HK.txt b/icu4c/source/data/locales/en_HK.txt
index 01f3fa3..93c0c11 100644
--- a/icu4c/source/data/locales/en_HK.txt
+++ b/icu4c/source/data/locales/en_HK.txt
@@ -354,6 +354,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/fy.txt b/icu4c/source/data/locales/fy.txt
index da55ece..655d7c0 100644
--- a/icu4c/source/data/locales/fy.txt
+++ b/icu4c/source/data/locales/fy.txt
@@ -1909,6 +1909,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/he.txt b/icu4c/source/data/locales/he.txt
index 9cef4c5..857a4cc 100644
--- a/icu4c/source/data/locales/he.txt
+++ b/icu4c/source/data/locales/he.txt
@@ -1289,6 +1289,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/hi.txt b/icu4c/source/data/locales/hi.txt
index e502fd7..ce1e566 100644
--- a/icu4c/source/data/locales/hi.txt
+++ b/icu4c/source/data/locales/hi.txt
@@ -1091,6 +1091,7 @@
"ताईशो",
"शोवा",
"हेईसेई",
+ "रेइवा",
}
}
}
diff --git a/icu4c/source/data/locales/hr.txt b/icu4c/source/data/locales/hr.txt
index f697e47..21c0186 100644
--- a/icu4c/source/data/locales/hr.txt
+++ b/icu4c/source/data/locales/hr.txt
@@ -1426,6 +1426,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/id.txt b/icu4c/source/data/locales/id.txt
index 40a19a0..35165a3 100644
--- a/icu4c/source/data/locales/id.txt
+++ b/icu4c/source/data/locales/id.txt
@@ -1780,6 +1780,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/ja.txt b/icu4c/source/data/locales/ja.txt
index 469ac1f..90088b8 100644
--- a/icu4c/source/data/locales/ja.txt
+++ b/icu4c/source/data/locales/ja.txt
@@ -2266,6 +2266,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
narrow{
"大化",
@@ -2504,6 +2505,7 @@
"T",
"S",
"H",
+ "R",
}
}
}
diff --git a/icu4c/source/data/locales/ko.txt b/icu4c/source/data/locales/ko.txt
index b7f584c..d608a44 100644
--- a/icu4c/source/data/locales/ko.txt
+++ b/icu4c/source/data/locales/ko.txt
@@ -1624,6 +1624,7 @@
"다이쇼",
"쇼와",
"헤이세이",
+ "레이와",
}
}
}
diff --git a/icu4c/source/data/locales/lo.txt b/icu4c/source/data/locales/lo.txt
index 083cd10..524a17b 100755
--- a/icu4c/source/data/locales/lo.txt
+++ b/icu4c/source/data/locales/lo.txt
@@ -1709,6 +1709,7 @@
"ໄຕໂຊ",
"ໂຊວາ",
"ຮີຊີ",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/lt.txt b/icu4c/source/data/locales/lt.txt
index b1987d8..b51ed21 100644
--- a/icu4c/source/data/locales/lt.txt
+++ b/icu4c/source/data/locales/lt.txt
@@ -2255,6 +2255,7 @@
"Taišo",
"Šova",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/nl.txt b/icu4c/source/data/locales/nl.txt
index 2cd87dc..1276471 100644
--- a/icu4c/source/data/locales/nl.txt
+++ b/icu4c/source/data/locales/nl.txt
@@ -2321,6 +2321,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/root.txt b/icu4c/source/data/locales/root.txt
index 3588d43..a18f601 100644
--- a/icu4c/source/data/locales/root.txt
+++ b/icu4c/source/data/locales/root.txt
@@ -1834,6 +1834,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
narrow{
"Taika (645-650)",
@@ -2072,6 +2073,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 7e86c2f..c510973 100644
--- a/icu4c/source/data/locales/ru.txt
+++ b/icu4c/source/data/locales/ru.txt
@@ -1513,6 +1513,7 @@
"Эпоха Тайсьо",
"Сьова",
"Эпоха Хэйсэй",
+ "Рэйва",
}
}
}
diff --git a/icu4c/source/data/locales/sr.txt b/icu4c/source/data/locales/sr.txt
index e555677..60f12bd 100644
--- a/icu4c/source/data/locales/sr.txt
+++ b/icu4c/source/data/locales/sr.txt
@@ -1108,6 +1108,7 @@
"Таишо",
"Шова",
"Хаисеи",
+ "Реива",
}
}
}
diff --git a/icu4c/source/data/locales/sr_Latn.txt b/icu4c/source/data/locales/sr_Latn.txt
index f9c52b0..83f17db 100644
--- a/icu4c/source/data/locales/sr_Latn.txt
+++ b/icu4c/source/data/locales/sr_Latn.txt
@@ -1109,6 +1109,7 @@
"Taišo",
"Šova",
"Haisei",
+ "Reiva",
}
}
}
diff --git a/icu4c/source/data/locales/sv.txt b/icu4c/source/data/locales/sv.txt
index f5b4e77..820f4e4 100644
--- a/icu4c/source/data/locales/sv.txt
+++ b/icu4c/source/data/locales/sv.txt
@@ -1369,6 +1369,7 @@
"Taishō",
"Shōwa",
"Heisei",
+ "Reiwa",
}
}
}
diff --git a/icu4c/source/data/locales/th.txt b/icu4c/source/data/locales/th.txt
index 6852d4e..deea5ae 100644
--- a/icu4c/source/data/locales/th.txt
+++ b/icu4c/source/data/locales/th.txt
@@ -2139,6 +2139,7 @@
"ทะอิโช",
"โชวะ",
"เฮเซ",
+ "เรวะ",
}
}
}
diff --git a/icu4c/source/data/locales/zh.txt b/icu4c/source/data/locales/zh.txt
index edda680..4bf3b17 100644
--- a/icu4c/source/data/locales/zh.txt
+++ b/icu4c/source/data/locales/zh.txt
@@ -1939,6 +1939,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
}
}
diff --git a/icu4c/source/data/locales/zh_Hant.txt b/icu4c/source/data/locales/zh_Hant.txt
index 9254024..31f7eac 100644
--- a/icu4c/source/data/locales/zh_Hant.txt
+++ b/icu4c/source/data/locales/zh_Hant.txt
@@ -2234,6 +2234,7 @@
"大正",
"昭和",
"平成",
+ "令和",
}
}
}
diff --git a/icu4c/source/i18n/japancal.cpp b/icu4c/source/i18n/japancal.cpp
index 0f985f0..7886185 100644
--- a/icu4c/source/i18n/japancal.cpp
+++ b/icu4c/source/i18n/japancal.cpp
@@ -273,7 +273,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 (sizeof(kEraInfo)/sizeof(kEraInfo[0]))
diff --git a/icu4c/source/test/intltest/incaltst.cpp b/icu4c/source/test/intltest/incaltst.cpp
index 7627696..b1db658 100644
--- a/icu4c/source/test/intltest/incaltst.cpp
+++ b/icu4c/source/test/intltest/incaltst.cpp
@@ -75,6 +75,7 @@
CASE(7,TestPersian);
CASE(8,TestPersianFormat);
CASE(9,TestTaiwan);
+ CASE(10,TestJapaneseHeiseiToReiwa);
default: name = ""; break;
}
}
@@ -624,23 +625,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("Coudln'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);
@@ -651,7 +652,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);
@@ -664,7 +665,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);
@@ -676,7 +677,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");
@@ -689,7 +690,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 +")");
@@ -698,13 +699,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 2c03ce3..45d6727 100644
--- a/icu4c/source/test/intltest/incaltst.h
+++ b/icu4c/source/test/intltest/incaltst.h
@@ -32,7 +32,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 e2d9962..a13f5a6 100644
--- a/icu4c/source/test/testdata/format.txt
+++ b/icu4c/source/test/testdata/format.txt
@@ -492,35 +492,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 58c88b8..8f4dca4 100644
--- a/icu4c/source/test/testdata/structLocale.txt
+++ b/icu4c/source/test/testdata/structLocale.txt
@@ -17986,6 +17986,7 @@
"",
"",
"",
+ "",
}
wide{
"",
@@ -18224,6 +18225,7 @@
"",
"",
"",
+ "",
}
narrow{
"",
@@ -18462,6 +18464,7 @@
"",
"",
"",
+ "",
}
}
}