diff --git a/Meta/CMake/locale_data.cmake b/Meta/CMake/locale_data.cmake index a548ff67e6..292247db55 100644 --- a/Meta/CMake/locale_data.cmake +++ b/Meta/CMake/locale_data.cmake @@ -1,6 +1,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake) -set(CLDR_VERSION 41.0.0) +set(CLDR_VERSION 42.0.0) set(CLDR_PATH "${CMAKE_BINARY_DIR}/CLDR" CACHE PATH "Download location for CLDR files") set(CLDR_VERSION_FILE "${CLDR_PATH}/version.txt") diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp index 644bbd0818..d8d6dc0527 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp @@ -39,8 +39,8 @@ constexpr auto s_calendar_pattern_list_index_type = "u8"sv; using CalendarRangePatternIndexType = u16; constexpr auto s_calendar_range_pattern_index_type = "u16"sv; -using CalendarRangePatternListIndexType = u8; -constexpr auto s_calendar_range_pattern_list_index_type = "u8"sv; +using CalendarRangePatternListIndexType = u16; +constexpr auto s_calendar_range_pattern_list_index_type = "u16"sv; using CalendarFormatIndexType = u8; constexpr auto s_calendar_format_index_type = "u8"sv; @@ -764,32 +764,48 @@ static constexpr auto is_char(char ch) // "{hour}:{minute} {ampm} {timeZoneName}" becomes "{hour}:{minute} {timeZoneName}" (remove one of the spaces around {ampm}) static String remove_period_from_pattern(String pattern) { + auto is_surrounding_space = [&](auto code_point_iterator) { + if (code_point_iterator.done()) + return false; + + constexpr auto spaces = Array { static_cast(0x0020), 0x00a0, 0x2009, 0x202f }; + return spaces.span().contains_slow(*code_point_iterator); + }; + + auto is_opening = [&](auto code_point_iterator) { + if (code_point_iterator.done()) + return false; + return *code_point_iterator == '{'; + }; + + auto is_closing = [&](auto code_point_iterator) { + if (code_point_iterator.done()) + return false; + return *code_point_iterator == '}'; + }; + for (auto remove : AK::Array { "({ampm})"sv, "{ampm}"sv, "({dayPeriod})"sv, "{dayPeriod}"sv }) { auto index = pattern.find(remove); if (!index.has_value()) continue; - constexpr u32 space = ' '; - constexpr u32 open = '{'; - constexpr u32 close = '}'; - Utf8View utf8_pattern { pattern }; - Optional before_removal; - Optional after_removal; + Utf8CodePointIterator before_removal; + Utf8CodePointIterator after_removal; for (auto it = utf8_pattern.begin(); utf8_pattern.byte_offset_of(it) < *index; ++it) - before_removal = *it; + before_removal = it; if (auto it = utf8_pattern.iterator_at_byte_offset(*index + remove.length()); it != utf8_pattern.end()) - after_removal = *it; + after_removal = it; - if ((before_removal == space) && (after_removal != open)) { + if (is_surrounding_space(before_removal) && !is_opening(after_removal)) { pattern = String::formatted("{}{}", - pattern.substring_view(0, *index - 1), + pattern.substring_view(0, *index - before_removal.underlying_code_point_length_in_bytes()), pattern.substring_view(*index + remove.length())); - } else if ((after_removal == space) && (before_removal != close)) { + } else if (is_surrounding_space(after_removal) && !is_closing(before_removal)) { pattern = String::formatted("{}{}", pattern.substring_view(0, *index), - pattern.substring_view(*index + remove.length() + 1)); + pattern.substring_view(*index + remove.length() + after_removal.underlying_code_point_length_in_bytes())); } else { pattern = String::formatted("{}{}", pattern.substring_view(0, *index), @@ -1466,9 +1482,10 @@ static ErrorOr parse_calendars(String locale_calendars_path, CLDR& cldr, L auto const& time_skeletons_object = value.as_object().get("timeSkeletons"sv); calendar.time_formats = parse_patterns(time_formats_object.as_object(), time_skeletons_object.as_object(), &time_formats); - auto const& date_time_formats_object = value.as_object().get("dateTimeFormats"sv); - calendar.date_time_formats = parse_patterns(date_time_formats_object.as_object(), JsonObject {}, nullptr); + auto const& standard_date_time_formats_object = value.as_object().get("dateTimeFormats-atTime"sv).as_object().get("standard"sv); + calendar.date_time_formats = parse_patterns(standard_date_time_formats_object.as_object(), JsonObject {}, nullptr); + auto const& date_time_formats_object = value.as_object().get("dateTimeFormats"sv); auto const& available_formats_object = date_time_formats_object.as_object().get("availableFormats"sv); available_formats_object.as_object().for_each_member([&](auto const& skeleton, JsonValue const& pattern) { auto pattern_index = parse_date_time_pattern(pattern.as_string(), skeleton, cldr); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp index 32f34ac24b..b8d69c4a99 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp @@ -43,8 +43,8 @@ constexpr auto s_currency_list_index_type = "u16"sv; using CalendarListIndexType = u8; constexpr auto s_calendar_list_index_type = "u8"sv; -using DateFieldListIndexType = u8; -constexpr auto s_date_field_list_index_type = "u8"sv; +using DateFieldListIndexType = u16; +constexpr auto s_date_field_list_index_type = "u16"sv; using KeywordListIndexType = u8; constexpr auto s_keyword_list_index_type = "u8"sv; diff --git a/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js b/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js index bb2bc638be..6c228e1a0a 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js @@ -31,11 +31,11 @@ describe("correct behavior", () => { const d1 = new Date(Date.UTC(1989, 0, 23, 7, 8, 9, 45)); test("defaults to date and time", () => { - expect(d0.toLocaleString("en", { timeZone: "UTC" })).toBe("12/7/2021, 5:40:50 PM"); - expect(d1.toLocaleString("en", { timeZone: "UTC" })).toBe("1/23/1989, 7:08:09 AM"); + expect(d0.toLocaleString("en", { timeZone: "UTC" })).toBe("12/7/2021, 5:40:50\u202fPM"); + expect(d1.toLocaleString("en", { timeZone: "UTC" })).toBe("1/23/1989, 7:08:09\u202fAM"); - expect(d0.toLocaleString("ar", { timeZone: "UTC" })).toBe("٧‏/١٢‏/٢٠٢١, ٥:٤٠:٥٠ م"); - expect(d1.toLocaleString("ar", { timeZone: "UTC" })).toBe("٢٣‏/١‏/١٩٨٩, ٧:٠٨:٠٩ ص"); + expect(d0.toLocaleString("ar", { timeZone: "UTC" })).toBe("٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م"); + expect(d1.toLocaleString("ar", { timeZone: "UTC" })).toBe("٢٣‏/١‏/١٩٨٩، ٧:٠٨:٠٩ ص"); }); test("dateStyle may be set", () => { @@ -51,8 +51,12 @@ describe("correct behavior", () => { }); test("timeStyle may be set", () => { - expect(d0.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe("5:40 PM"); - expect(d1.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe("7:08 AM"); + expect(d0.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe( + "5:40\u202fPM" + ); + expect(d1.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe( + "7:08\u202fAM" + ); expect(d0.toLocaleString("ar", { timeStyle: "short", timeZone: "UTC" })).toBe("٥:٤٠ م"); expect(d1.toLocaleString("ar", { timeStyle: "short", timeZone: "UTC" })).toBe("٧:٠٨ ص"); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js b/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js index d188994039..400feac730 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js @@ -37,8 +37,8 @@ describe("correct behavior", () => { const d1 = new Date(Date.UTC(1989, 0, 23, 7, 8, 9, 45)); test("defaults to time", () => { - expect(d0.toLocaleTimeString("en", { timeZone: "UTC" })).toBe("5:40:50 PM"); - expect(d1.toLocaleTimeString("en", { timeZone: "UTC" })).toBe("7:08:09 AM"); + expect(d0.toLocaleTimeString("en", { timeZone: "UTC" })).toBe("5:40:50\u202fPM"); + expect(d1.toLocaleTimeString("en", { timeZone: "UTC" })).toBe("7:08:09\u202fAM"); expect(d0.toLocaleTimeString("ar", { timeZone: "UTC" })).toBe("٥:٤٠:٥٠ م"); expect(d1.toLocaleTimeString("ar", { timeZone: "UTC" })).toBe("٧:٠٨:٠٩ ص"); @@ -46,10 +46,10 @@ describe("correct behavior", () => { test("timeStyle may be set", () => { expect(d0.toLocaleTimeString("en", { timeStyle: "long", timeZone: "UTC" })).toBe( - "5:40:50 PM UTC" + "5:40:50\u202fPM UTC" ); expect(d1.toLocaleTimeString("en", { timeStyle: "long", timeZone: "UTC" })).toBe( - "7:08:09 AM UTC" + "7:08:09\u202fAM UTC" ); expect(d0.toLocaleTimeString("ar", { timeStyle: "long", timeZone: "UTC" })).toBe( diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js index 21698b0ab2..2661208e22 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js @@ -62,10 +62,10 @@ describe("dateStyle", () => { describe("timeStyle", () => { // prettier-ignore const data = [ - { time: "full", en0: "5:40:50 PM Coordinated Universal Time", en1: "7:08:09 AM Coordinated Universal Time", ar0: "٥:٤٠:٥٠ م التوقيت العالمي المنسق", ar1: "٧:٠٨:٠٩ ص التوقيت العالمي المنسق" }, - { time: "long", en0: "5:40:50 PM UTC", en1: "7:08:09 AM UTC", ar0: "٥:٤٠:٥٠ م UTC", ar1: "٧:٠٨:٠٩ ص UTC" }, - { time: "medium", en0: "5:40:50 PM", en1: "7:08:09 AM", ar0: "٥:٤٠:٥٠ م", ar1: "٧:٠٨:٠٩ ص" }, - { time: "short", en0: "5:40 PM", en1: "7:08 AM", ar0: "٥:٤٠ م", ar1: "٧:٠٨ ص" }, + { time: "full", en0: "5:40:50\u202fPM Coordinated Universal Time", en1: "7:08:09\u202fAM Coordinated Universal Time", ar0: "٥:٤٠:٥٠ م التوقيت العالمي المنسق", ar1: "٧:٠٨:٠٩ ص التوقيت العالمي المنسق" }, + { time: "long", en0: "5:40:50\u202fPM UTC", en1: "7:08:09\u202fAM UTC", ar0: "٥:٤٠:٥٠ م UTC", ar1: "٧:٠٨:٠٩ ص UTC" }, + { time: "medium", en0: "5:40:50\u202fPM", en1: "7:08:09\u202fAM", ar0: "٥:٤٠:٥٠ م", ar1: "٧:٠٨:٠٩ ص" }, + { time: "short", en0: "5:40\u202fPM", en1: "7:08\u202fAM", ar0: "٥:٤٠ م", ar1: "٧:٠٨ ص" }, ]; test("all", () => { @@ -84,22 +84,22 @@ describe("timeStyle", () => { describe("dateStyle + timeStyle", () => { // prettier-ignore const data = [ - { date: "full", time: "full", en: "Tuesday, December 7, 2021 at 5:40:50 PM Coordinated Universal Time", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, - { date: "full", time: "long", en: "Tuesday, December 7, 2021 at 5:40:50 PM UTC", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م UTC" }, - { date: "full", time: "medium", en: "Tuesday, December 7, 2021 at 5:40:50 PM", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م" }, - { date: "full", time: "short", en: "Tuesday, December 7, 2021 at 5:40 PM", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠ م" }, - { date: "long", time: "full", en: "December 7, 2021 at 5:40:50 PM Coordinated Universal Time", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, - { date: "long", time: "long", en: "December 7, 2021 at 5:40:50 PM UTC", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م UTC" }, - { date: "long", time: "medium", en: "December 7, 2021 at 5:40:50 PM", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م" }, - { date: "long", time: "short", en: "December 7, 2021 at 5:40 PM", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠ م" }, - { date: "medium", time: "full", en: "Dec 7, 2021, 5:40:50 PM Coordinated Universal Time", ar: "٠٧‏/١٢‏/٢٠٢١, ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, - { date: "medium", time: "long", en: "Dec 7, 2021, 5:40:50 PM UTC", ar: "٠٧‏/١٢‏/٢٠٢١, ٥:٤٠:٥٠ م UTC" }, - { date: "medium", time: "medium", en: "Dec 7, 2021, 5:40:50 PM", ar: "٠٧‏/١٢‏/٢٠٢١, ٥:٤٠:٥٠ م" }, - { date: "medium", time: "short", en: "Dec 7, 2021, 5:40 PM", ar: "٠٧‏/١٢‏/٢٠٢١, ٥:٤٠ م" }, - { date: "short", time: "full", en: "12/7/21, 5:40:50 PM Coordinated Universal Time", ar: "٧‏/١٢‏/٢٠٢١, ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, - { date: "short", time: "long", en: "12/7/21, 5:40:50 PM UTC", ar: "٧‏/١٢‏/٢٠٢١, ٥:٤٠:٥٠ م UTC" }, - { date: "short", time: "medium", en: "12/7/21, 5:40:50 PM", ar: "٧‏/١٢‏/٢٠٢١, ٥:٤٠:٥٠ م" }, - { date: "short", time: "short", en: "12/7/21, 5:40 PM", ar: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م" }, + { date: "full", time: "full", en: "Tuesday, December 7, 2021 at 5:40:50\u202fPM Coordinated Universal Time", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, + { date: "full", time: "long", en: "Tuesday, December 7, 2021 at 5:40:50\u202fPM UTC", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م UTC" }, + { date: "full", time: "medium", en: "Tuesday, December 7, 2021 at 5:40:50\u202fPM", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م" }, + { date: "full", time: "short", en: "Tuesday, December 7, 2021 at 5:40\u202fPM", ar: "الثلاثاء، ٧ ديسمبر ٢٠٢١ في ٥:٤٠ م" }, + { date: "long", time: "full", en: "December 7, 2021 at 5:40:50\u202fPM Coordinated Universal Time", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, + { date: "long", time: "long", en: "December 7, 2021 at 5:40:50\u202fPM UTC", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م UTC" }, + { date: "long", time: "medium", en: "December 7, 2021 at 5:40:50\u202fPM", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠:٥٠ م" }, + { date: "long", time: "short", en: "December 7, 2021 at 5:40\u202fPM", ar: "٧ ديسمبر ٢٠٢١ في ٥:٤٠ م" }, + { date: "medium", time: "full", en: "Dec 7, 2021, 5:40:50\u202fPM Coordinated Universal Time", ar: "٠٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, + { date: "medium", time: "long", en: "Dec 7, 2021, 5:40:50\u202fPM UTC", ar: "٠٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م UTC" }, + { date: "medium", time: "medium", en: "Dec 7, 2021, 5:40:50\u202fPM", ar: "٠٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م" }, + { date: "medium", time: "short", en: "Dec 7, 2021, 5:40\u202fPM", ar: "٠٧‏/١٢‏/٢٠٢١، ٥:٤٠ م" }, + { date: "short", time: "full", en: "12/7/21, 5:40:50\u202fPM Coordinated Universal Time", ar: "٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م التوقيت العالمي المنسق" }, + { date: "short", time: "long", en: "12/7/21, 5:40:50\u202fPM UTC", ar: "٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م UTC" }, + { date: "short", time: "medium", en: "12/7/21, 5:40:50\u202fPM", ar: "٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م" }, + { date: "short", time: "short", en: "12/7/21, 5:40\u202fPM", ar: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م" }, ]; test("all", () => { @@ -361,7 +361,7 @@ describe("hour", () => { // pattern, which should only be applied to 24-hour cycles. const data = [ { hour: "2-digit", en0: "05", en1: "07", ar0: "٠٥", ar1: "٠٧" }, - { hour: "numeric", en0: "5 PM", en1: "7 AM", ar0: "٥ م", ar1: "٧ ص" }, + { hour: "numeric", en0: "5\u202fPM", en1: "7\u202fAM", ar0: "٥ م", ar1: "٧ ص" }, ]; test("all", () => { @@ -380,8 +380,8 @@ describe("hour", () => { describe("minute", () => { // prettier-ignore const data = [ - { minute: "2-digit", en0: "5:40 PM", en1: "7:08 AM", ar0: "٥:٤٠ م", ar1: "٧:٠٨ ص" }, - { minute: "numeric", en0: "5:40 PM", en1: "7:08 AM", ar0: "٥:٤٠ م", ar1: "٧:٠٨ ص" }, + { minute: "2-digit", en0: "5:40\u202fPM", en1: "7:08\u202fAM", ar0: "٥:٤٠ م", ar1: "٧:٠٨ ص" }, + { minute: "numeric", en0: "5:40\u202fPM", en1: "7:08\u202fAM", ar0: "٥:٤٠ م", ar1: "٧:٠٨ ص" }, ]; test("all", () => { @@ -467,40 +467,40 @@ describe("fractionalSecondDigits", () => { describe("timeZoneName", () => { // prettier-ignore const data = [ - { timeZone: "UTC", timeZoneName: "short", en0: "12/7/2021, 5:40 PM UTC", en1: "1/23/1989, 7:08 AM UTC", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م UTC", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص UTC" }, - { timeZone: "UTC", timeZoneName: "long", en0: "12/7/2021, 5:40 PM Coordinated Universal Time", en1: "1/23/1989, 7:08 AM Coordinated Universal Time", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م التوقيت العالمي المنسق", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص التوقيت العالمي المنسق" }, - { timeZone: "UTC", timeZoneName: "shortOffset", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, - { timeZone: "UTC", timeZoneName: "longOffset", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, - { timeZone: "UTC", timeZoneName: "shortGeneric", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, - { timeZone: "UTC", timeZoneName: "longGeneric", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, + { timeZone: "UTC", timeZoneName: "short", en0: "12/7/2021, 5:40\u202fPM UTC", en1: "1/23/1989, 7:08\u202fAM UTC", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م UTC", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص UTC" }, + { timeZone: "UTC", timeZoneName: "long", en0: "12/7/2021, 5:40\u202fPM Coordinated Universal Time", en1: "1/23/1989, 7:08\u202fAM Coordinated Universal Time", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م التوقيت العالمي المنسق", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص التوقيت العالمي المنسق" }, + { timeZone: "UTC", timeZoneName: "shortOffset", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, + { timeZone: "UTC", timeZoneName: "longOffset", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, + { timeZone: "UTC", timeZoneName: "shortGeneric", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, + { timeZone: "UTC", timeZoneName: "longGeneric", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, - { timeZone: "America/New_York", timeZoneName: "short", en0: "12/7/2021, 12:40 PM EST", en1: "1/23/1989, 2:08 AM EST", ar0: "٧‏/١٢‏/٢٠٢١, ١٢:٤٠ م غرينتش-٥", ar1: "٢٣‏/١‏/١٩٨٩, ٢:٠٨ ص غرينتش-٥" }, - { timeZone: "America/New_York", timeZoneName: "long", en0: "12/7/2021, 12:40 PM Eastern Standard Time", en1: "1/23/1989, 2:08 AM Eastern Standard Time", ar0: "٧‏/١٢‏/٢٠٢١, ١٢:٤٠ م التوقيت الرسمي الشرقي لأمريكا الشمالية", ar1: "٢٣‏/١‏/١٩٨٩, ٢:٠٨ ص التوقيت الرسمي الشرقي لأمريكا الشمالية" }, - { timeZone: "America/New_York", timeZoneName: "shortOffset", en0: "12/7/2021, 12:40 PM GMT-5", en1: "1/23/1989, 2:08 AM GMT-5", ar0: "٧‏/١٢‏/٢٠٢١, ١٢:٤٠ م غرينتش-٥", ar1: "٢٣‏/١‏/١٩٨٩, ٢:٠٨ ص غرينتش-٥" }, - { timeZone: "America/New_York", timeZoneName: "longOffset", en0: "12/7/2021, 12:40 PM GMT-05:00", en1: "1/23/1989, 2:08 AM GMT-05:00", ar0: "٧‏/١٢‏/٢٠٢١, ١٢:٤٠ م غرينتش-٠٥:٠٠", ar1: "٢٣‏/١‏/١٩٨٩, ٢:٠٨ ص غرينتش-٠٥:٠٠" }, - { timeZone: "America/New_York", timeZoneName: "shortGeneric", en0: "12/7/2021, 12:40 PM ET", en1: "1/23/1989, 2:08 AM ET", ar0: "٧‏/١٢‏/٢٠٢١, ١٢:٤٠ م غرينتش-٥", ar1: "٢٣‏/١‏/١٩٨٩, ٢:٠٨ ص غرينتش-٥" }, - { timeZone: "America/New_York", timeZoneName: "longGeneric", en0: "12/7/2021, 12:40 PM Eastern Time", en1: "1/23/1989, 2:08 AM Eastern Time", ar0: "٧‏/١٢‏/٢٠٢١, ١٢:٤٠ م التوقيت الشرقي لأمريكا الشمالية", ar1: "٢٣‏/١‏/١٩٨٩, ٢:٠٨ ص التوقيت الشرقي لأمريكا الشمالية" }, + { timeZone: "America/New_York", timeZoneName: "short", en0: "12/7/2021, 12:40\u202fPM EST", en1: "1/23/1989, 2:08\u202fAM EST", ar0: "٧‏/١٢‏/٢٠٢١، ١٢:٤٠ م غرينتش-٥", ar1: "٢٣‏/١‏/١٩٨٩، ٢:٠٨ ص غرينتش-٥" }, + { timeZone: "America/New_York", timeZoneName: "long", en0: "12/7/2021, 12:40\u202fPM Eastern Standard Time", en1: "1/23/1989, 2:08\u202fAM Eastern Standard Time", ar0: "٧‏/١٢‏/٢٠٢١، ١٢:٤٠ م التوقيت الرسمي الشرقي لأمريكا الشمالية", ar1: "٢٣‏/١‏/١٩٨٩، ٢:٠٨ ص التوقيت الرسمي الشرقي لأمريكا الشمالية" }, + { timeZone: "America/New_York", timeZoneName: "shortOffset", en0: "12/7/2021, 12:40\u202fPM GMT-5", en1: "1/23/1989, 2:08\u202fAM GMT-5", ar0: "٧‏/١٢‏/٢٠٢١، ١٢:٤٠ م غرينتش-٥", ar1: "٢٣‏/١‏/١٩٨٩، ٢:٠٨ ص غرينتش-٥" }, + { timeZone: "America/New_York", timeZoneName: "longOffset", en0: "12/7/2021, 12:40\u202fPM GMT-05:00", en1: "1/23/1989, 2:08\u202fAM GMT-05:00", ar0: "٧‏/١٢‏/٢٠٢١، ١٢:٤٠ م غرينتش-٠٥:٠٠", ar1: "٢٣‏/١‏/١٩٨٩، ٢:٠٨ ص غرينتش-٠٥:٠٠" }, + { timeZone: "America/New_York", timeZoneName: "shortGeneric", en0: "12/7/2021, 12:40\u202fPM ET", en1: "1/23/1989, 2:08\u202fAM ET", ar0: "٧‏/١٢‏/٢٠٢١، ١٢:٤٠ م غرينتش-٥", ar1: "٢٣‏/١‏/١٩٨٩، ٢:٠٨ ص غرينتش-٥" }, + { timeZone: "America/New_York", timeZoneName: "longGeneric", en0: "12/7/2021, 12:40\u202fPM Eastern Time", en1: "1/23/1989, 2:08\u202fAM Eastern Time", ar0: "٧‏/١٢‏/٢٠٢١، ١٢:٤٠ م التوقيت الشرقي لأمريكا الشمالية", ar1: "٢٣‏/١‏/١٩٨٩، ٢:٠٨ ص التوقيت الشرقي لأمريكا الشمالية" }, - { timeZone: "Europe/London", timeZoneName: "short", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, - { timeZone: "Europe/London", timeZoneName: "long", en0: "12/7/2021, 5:40 PM Greenwich Mean Time", en1: "1/23/1989, 7:08 AM Greenwich Mean Time", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م توقيت غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص توقيت غرينتش" }, - { timeZone: "Europe/London", timeZoneName: "shortOffset", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, - { timeZone: "Europe/London", timeZoneName: "longOffset", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, - { timeZone: "Europe/London", timeZoneName: "shortGeneric", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, - { timeZone: "Europe/London", timeZoneName: "longGeneric", en0: "12/7/2021, 5:40 PM GMT", en1: "1/23/1989, 7:08 AM GMT", ar0: "٧‏/١٢‏/٢٠٢١, ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩, ٧:٠٨ ص غرينتش" }, + { timeZone: "Europe/London", timeZoneName: "short", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, + { timeZone: "Europe/London", timeZoneName: "long", en0: "12/7/2021, 5:40\u202fPM Greenwich Mean Time", en1: "1/23/1989, 7:08\u202fAM Greenwich Mean Time", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م توقيت غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص توقيت غرينتش" }, + { timeZone: "Europe/London", timeZoneName: "shortOffset", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, + { timeZone: "Europe/London", timeZoneName: "longOffset", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, + { timeZone: "Europe/London", timeZoneName: "shortGeneric", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, + { timeZone: "Europe/London", timeZoneName: "longGeneric", en0: "12/7/2021, 5:40\u202fPM GMT", en1: "1/23/1989, 7:08\u202fAM GMT", ar0: "٧‏/١٢‏/٢٠٢١، ٥:٤٠ م غرينتش", ar1: "٢٣‏/١‏/١٩٨٩، ٧:٠٨ ص غرينتش" }, - { timeZone: "America/Los_Angeles", timeZoneName: "short", en0: "12/7/2021, 9:40 AM PST", en1: "1/22/1989, 11:08 PM PST", ar0: "٧‏/١٢‏/٢٠٢١, ٩:٤٠ ص غرينتش-٨", ar1: "٢٢‏/١‏/١٩٨٩, ١١:٠٨ م غرينتش-٨" }, - { timeZone: "America/Los_Angeles", timeZoneName: "long", en0: "12/7/2021, 9:40 AM Pacific Standard Time", en1: "1/22/1989, 11:08 PM Pacific Standard Time", ar0: "٧‏/١٢‏/٢٠٢١, ٩:٤٠ ص توقيت المحيط الهادي الرسمي", ar1: "٢٢‏/١‏/١٩٨٩, ١١:٠٨ م توقيت المحيط الهادي الرسمي" }, - { timeZone: "America/Los_Angeles", timeZoneName: "shortOffset", en0: "12/7/2021, 9:40 AM GMT-8", en1: "1/22/1989, 11:08 PM GMT-8", ar0: "٧‏/١٢‏/٢٠٢١, ٩:٤٠ ص غرينتش-٨", ar1: "٢٢‏/١‏/١٩٨٩, ١١:٠٨ م غرينتش-٨" }, - { timeZone: "America/Los_Angeles", timeZoneName: "longOffset", en0: "12/7/2021, 9:40 AM GMT-08:00", en1: "1/22/1989, 11:08 PM GMT-08:00", ar0: "٧‏/١٢‏/٢٠٢١, ٩:٤٠ ص غرينتش-٠٨:٠٠", ar1: "٢٢‏/١‏/١٩٨٩, ١١:٠٨ م غرينتش-٠٨:٠٠" }, - { timeZone: "America/Los_Angeles", timeZoneName: "shortGeneric", en0: "12/7/2021, 9:40 AM PT", en1: "1/22/1989, 11:08 PM PT", ar0: "٧‏/١٢‏/٢٠٢١, ٩:٤٠ ص غرينتش-٨", ar1: "٢٢‏/١‏/١٩٨٩, ١١:٠٨ م غرينتش-٨" }, - { timeZone: "America/Los_Angeles", timeZoneName: "longGeneric", en0: "12/7/2021, 9:40 AM Pacific Time", en1: "1/22/1989, 11:08 PM Pacific Time", ar0: "٧‏/١٢‏/٢٠٢١, ٩:٤٠ ص توقيت المحيط الهادي", ar1: "٢٢‏/١‏/١٩٨٩, ١١:٠٨ م توقيت المحيط الهادي" }, + { timeZone: "America/Los_Angeles", timeZoneName: "short", en0: "12/7/2021, 9:40\u202fAM PST", en1: "1/22/1989, 11:08\u202fPM PST", ar0: "٧‏/١٢‏/٢٠٢١، ٩:٤٠ ص غرينتش-٨", ar1: "٢٢‏/١‏/١٩٨٩، ١١:٠٨ م غرينتش-٨" }, + { timeZone: "America/Los_Angeles", timeZoneName: "long", en0: "12/7/2021, 9:40\u202fAM Pacific Standard Time", en1: "1/22/1989, 11:08\u202fPM Pacific Standard Time", ar0: "٧‏/١٢‏/٢٠٢١، ٩:٤٠ ص توقيت المحيط الهادي الرسمي", ar1: "٢٢‏/١‏/١٩٨٩، ١١:٠٨ م توقيت المحيط الهادي الرسمي" }, + { timeZone: "America/Los_Angeles", timeZoneName: "shortOffset", en0: "12/7/2021, 9:40\u202fAM GMT-8", en1: "1/22/1989, 11:08\u202fPM GMT-8", ar0: "٧‏/١٢‏/٢٠٢١، ٩:٤٠ ص غرينتش-٨", ar1: "٢٢‏/١‏/١٩٨٩، ١١:٠٨ م غرينتش-٨" }, + { timeZone: "America/Los_Angeles", timeZoneName: "longOffset", en0: "12/7/2021, 9:40\u202fAM GMT-08:00", en1: "1/22/1989, 11:08\u202fPM GMT-08:00", ar0: "٧‏/١٢‏/٢٠٢١، ٩:٤٠ ص غرينتش-٠٨:٠٠", ar1: "٢٢‏/١‏/١٩٨٩، ١١:٠٨ م غرينتش-٠٨:٠٠" }, + { timeZone: "America/Los_Angeles", timeZoneName: "shortGeneric", en0: "12/7/2021, 9:40\u202fAM PT", en1: "1/22/1989, 11:08\u202fPM PT", ar0: "٧‏/١٢‏/٢٠٢١، ٩:٤٠ ص غرينتش-٨", ar1: "٢٢‏/١‏/١٩٨٩، ١١:٠٨ م غرينتش-٨" }, + { timeZone: "America/Los_Angeles", timeZoneName: "longGeneric", en0: "12/7/2021, 9:40\u202fAM Pacific Time", en1: "1/22/1989, 11:08\u202fPM Pacific Time", ar0: "٧‏/١٢‏/٢٠٢١، ٩:٤٠ ص توقيت المحيط الهادي", ar1: "٢٢‏/١‏/١٩٨٩، ١١:٠٨ م توقيت المحيط الهادي" }, - { timeZone: "Asia/Kathmandu", timeZoneName: "short", en0: "12/7/2021, 11:25 PM GMT+5:45", en1: "1/23/1989, 12:53 PM GMT+5:45", ar0: "٧‏/١٢‏/٢٠٢١, ١١:٢٥ م غرينتش+٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩, ١٢:٥٣ م غرينتش+٥:٤٥" }, - { timeZone: "Asia/Kathmandu", timeZoneName: "long", en0: "12/7/2021, 11:25 PM Nepal Time", en1: "1/23/1989, 12:53 PM Nepal Time", ar0: "٧‏/١٢‏/٢٠٢١, ١١:٢٥ م توقيت نيبال", ar1: "٢٣‏/١‏/١٩٨٩, ١٢:٥٣ م توقيت نيبال" }, - { timeZone: "Asia/Kathmandu", timeZoneName: "shortOffset", en0: "12/7/2021, 11:25 PM GMT+5:45", en1: "1/23/1989, 12:53 PM GMT+5:45", ar0: "٧‏/١٢‏/٢٠٢١, ١١:٢٥ م غرينتش+٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩, ١٢:٥٣ م غرينتش+٥:٤٥" }, - { timeZone: "Asia/Kathmandu", timeZoneName: "longOffset", en0: "12/7/2021, 11:25 PM GMT+05:45", en1: "1/23/1989, 12:53 PM GMT+05:45", ar0: "٧‏/١٢‏/٢٠٢١, ١١:٢٥ م غرينتش+٠٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩, ١٢:٥٣ م غرينتش+٠٥:٤٥" }, - { timeZone: "Asia/Kathmandu", timeZoneName: "shortGeneric", en0: "12/7/2021, 11:25 PM GMT+5:45", en1: "1/23/1989, 12:53 PM GMT+5:45", ar0: "٧‏/١٢‏/٢٠٢١, ١١:٢٥ م غرينتش+٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩, ١٢:٥٣ م غرينتش+٥:٤٥" }, - { timeZone: "Asia/Kathmandu", timeZoneName: "longGeneric", en0: "12/7/2021, 11:25 PM GMT+05:45", en1: "1/23/1989, 12:53 PM GMT+05:45", ar0: "٧‏/١٢‏/٢٠٢١, ١١:٢٥ م غرينتش+٠٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩, ١٢:٥٣ م غرينتش+٠٥:٤٥" }, + { timeZone: "Asia/Kathmandu", timeZoneName: "short", en0: "12/7/2021, 11:25\u202fPM GMT+5:45", en1: "1/23/1989, 12:53\u202fPM GMT+5:45", ar0: "٧‏/١٢‏/٢٠٢١، ١١:٢٥ م غرينتش+٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩، ١٢:٥٣ م غرينتش+٥:٤٥" }, + { timeZone: "Asia/Kathmandu", timeZoneName: "long", en0: "12/7/2021, 11:25\u202fPM Nepal Time", en1: "1/23/1989, 12:53\u202fPM Nepal Time", ar0: "٧‏/١٢‏/٢٠٢١، ١١:٢٥ م توقيت نيبال", ar1: "٢٣‏/١‏/١٩٨٩، ١٢:٥٣ م توقيت نيبال" }, + { timeZone: "Asia/Kathmandu", timeZoneName: "shortOffset", en0: "12/7/2021, 11:25\u202fPM GMT+5:45", en1: "1/23/1989, 12:53\u202fPM GMT+5:45", ar0: "٧‏/١٢‏/٢٠٢١، ١١:٢٥ م غرينتش+٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩، ١٢:٥٣ م غرينتش+٥:٤٥" }, + { timeZone: "Asia/Kathmandu", timeZoneName: "longOffset", en0: "12/7/2021, 11:25\u202fPM GMT+05:45", en1: "1/23/1989, 12:53\u202fPM GMT+05:45", ar0: "٧‏/١٢‏/٢٠٢١، ١١:٢٥ م غرينتش+٠٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩، ١٢:٥٣ م غرينتش+٠٥:٤٥" }, + { timeZone: "Asia/Kathmandu", timeZoneName: "shortGeneric", en0: "12/7/2021, 11:25\u202fPM GMT+5:45", en1: "1/23/1989, 12:53\u202fPM GMT+5:45", ar0: "٧‏/١٢‏/٢٠٢١، ١١:٢٥ م غرينتش+٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩، ١٢:٥٣ م غرينتش+٥:٤٥" }, + { timeZone: "Asia/Kathmandu", timeZoneName: "longGeneric", en0: "12/7/2021, 11:25\u202fPM GMT+05:45", en1: "1/23/1989, 12:53\u202fPM GMT+05:45", ar0: "٧‏/١٢‏/٢٠٢١، ١١:٢٥ م غرينتش+٠٥:٤٥", ar1: "٢٣‏/١‏/١٩٨٩، ١٢:٥٣ م غرينتش+٠٥:٤٥" }, ]; test("all", () => { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js index c703ee31f6..a3d546f4ac 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js @@ -69,8 +69,8 @@ describe("equal dates are squashed", () => { second: "2-digit", timeZone: "UTC", }); - expect(en.formatRange(d0, d0)).toBe("7:08:09 AM"); - expect(en.formatRange(d1, d1)).toBe("5:40:50 PM"); + expect(en.formatRange(d0, d0)).toBe("7:08:09\u202fAM"); + expect(en.formatRange(d1, d1)).toBe("5:40:50\u202fPM"); const ja = new Intl.DateTimeFormat("ja", { hour: "numeric", @@ -92,8 +92,8 @@ describe("equal dates are squashed", () => { second: "2-digit", timeZone: "UTC", }); - expect(en.formatRange(d0, d0)).toBe("January 23, 1989 at 7:08:09 AM"); - expect(en.formatRange(d1, d1)).toBe("December 07, 2021 at 5:40:50 PM"); + expect(en.formatRange(d0, d0)).toBe("January 23, 1989 at 7:08:09\u202fAM"); + expect(en.formatRange(d1, d1)).toBe("December 07, 2021 at 5:40:50\u202fPM"); const ja = new Intl.DateTimeFormat("ja", { year: "numeric", @@ -114,8 +114,8 @@ describe("equal dates are squashed", () => { timeStyle: "medium", timeZone: "UTC", }); - expect(en.formatRange(d0, d0)).toBe("Monday, January 23, 1989 at 7:08:09 AM"); - expect(en.formatRange(d1, d1)).toBe("Tuesday, December 7, 2021 at 5:40:50 PM"); + expect(en.formatRange(d0, d0)).toBe("Monday, January 23, 1989 at 7:08:09\u202fAM"); + expect(en.formatRange(d1, d1)).toBe("Tuesday, December 7, 2021 at 5:40:50\u202fPM"); const ja = new Intl.DateTimeFormat("ja", { dateStyle: "full", @@ -130,10 +130,10 @@ describe("equal dates are squashed", () => { describe("dateStyle", () => { // prettier-ignore const data = [ - { date: "full", en: "Monday, January 23, 1989 – Tuesday, December 7, 2021", ja: "1989年1月23日月曜日~2021年12月7日火曜日" }, - { date: "long", en: "January 23, 1989 – December 7, 2021", ja: "1989/01/23~2021/12/07" }, - { date: "medium", en: "Jan 23, 1989 – Dec 7, 2021", ja: "1989/01/23~2021/12/07" }, - { date: "short", en: "1/23/89 – 12/7/21", ja: "1989/01/23~2021/12/07" }, + { date: "full", en: "Monday, January 23, 1989\u2009–\u2009Tuesday, December 7, 2021", ja: "1989年1月23日月曜日~2021年12月7日火曜日" }, + { date: "long", en: "January 23, 1989\u2009–\u2009December 7, 2021", ja: "1989/01/23~2021/12/07" }, + { date: "medium", en: "Jan 23, 1989\u2009–\u2009Dec 7, 2021", ja: "1989/01/23~2021/12/07" }, + { date: "short", en: "1/23/89\u2009–\u200912/7/21", ja: "1989/01/23~2021/12/07" }, ]; test("all", () => { @@ -154,7 +154,9 @@ describe("dateStyle", () => { test("dates in reverse order", () => { const en = new Intl.DateTimeFormat("en", { dateStyle: "full", timeZone: "UTC" }); - expect(en.formatRange(d1, d0)).toBe("Tuesday, December 7, 2021 – Monday, January 23, 1989"); + expect(en.formatRange(d1, d0)).toBe( + "Tuesday, December 7, 2021\u2009–\u2009Monday, January 23, 1989" + ); const ja = new Intl.DateTimeFormat("ja", { dateStyle: "full", timeZone: "UTC" }); expect(ja.formatRange(d1, d0)).toBe("2021年12月7日火曜日~1989年1月23日月曜日"); @@ -166,10 +168,10 @@ describe("timeStyle", () => { const data = [ // FIXME: These results should include the date, even though it isn't requested, because the start/end dates // are more than just hours apart. See the FIXME in PartitionDateTimeRangePattern. - { time: "full", en: "7:08:09 AM Coordinated Universal Time – 5:40:50 PM Coordinated Universal Time", ja: "7時08分09秒 協定世界時~17時40分50秒 協定世界時" }, - { time: "long", en: "7:08:09 AM UTC – 5:40:50 PM UTC", ja: "7:08:09 UTC~17:40:50 UTC" }, - { time: "medium", en: "7:08:09 AM – 5:40:50 PM", ja: "7:08:09~17:40:50" }, - { time: "short", en: "7:08 AM – 5:40 PM", ja: "7:08~17:40" }, + { time: "full", en: "7:08:09\u202fAM Coordinated Universal Time\u2009–\u20095:40:50\u202fPM Coordinated Universal Time", ja: "7時08分09秒 協定世界時~17時40分50秒 協定世界時" }, + { time: "long", en: "7:08:09\u202fAM UTC\u2009–\u20095:40:50\u202fPM UTC", ja: "7:08:09 UTC~17:40:50 UTC" }, + { time: "medium", en: "7:08:09\u202fAM\u2009–\u20095:40:50\u202fPM", ja: "7:08:09~17:40:50" }, + { time: "short", en: "7:08\u202fAM\u2009–\u20095:40\u202fPM", ja: "7:08~17:40" }, ]; test("all", () => { @@ -186,22 +188,22 @@ describe("timeStyle", () => { describe("dateStyle + timeStyle", () => { // prettier-ignore const data = [ - { date: "full", time: "full", en: "Monday, January 23, 1989 at 7:08:09 AM Coordinated Universal Time – Tuesday, December 7, 2021 at 5:40:50 PM Coordinated Universal Time", ja: "1989年1月23日月曜日 7時08分09秒 協定世界時~2021年12月7日火曜日 17時40分50秒 協定世界時" }, - { date: "full", time: "long", en: "Monday, January 23, 1989 at 7:08:09 AM UTC – Tuesday, December 7, 2021 at 5:40:50 PM UTC", ja: "1989年1月23日月曜日 7:08:09 UTC~2021年12月7日火曜日 17:40:50 UTC" }, - { date: "full", time: "medium", en: "Monday, January 23, 1989 at 7:08:09 AM – Tuesday, December 7, 2021 at 5:40:50 PM", ja: "1989年1月23日月曜日 7:08:09~2021年12月7日火曜日 17:40:50" }, - { date: "full", time: "short", en: "Monday, January 23, 1989 at 7:08 AM – Tuesday, December 7, 2021 at 5:40 PM", ja: "1989年1月23日月曜日 7:08~2021年12月7日火曜日 17:40" }, - { date: "long", time: "full", en: "January 23, 1989 at 7:08:09 AM Coordinated Universal Time – December 7, 2021 at 5:40:50 PM Coordinated Universal Time", ja: "1989年1月23日 7時08分09秒 協定世界時~2021年12月7日 17時40分50秒 協定世界時" }, - { date: "long", time: "long", en: "January 23, 1989 at 7:08:09 AM UTC – December 7, 2021 at 5:40:50 PM UTC", ja: "1989年1月23日 7:08:09 UTC~2021年12月7日 17:40:50 UTC" }, - { date: "long", time: "medium", en: "January 23, 1989 at 7:08:09 AM – December 7, 2021 at 5:40:50 PM", ja: "1989年1月23日 7:08:09~2021年12月7日 17:40:50" }, - { date: "long", time: "short", en: "January 23, 1989 at 7:08 AM – December 7, 2021 at 5:40 PM", ja: "1989年1月23日 7:08~2021年12月7日 17:40" }, - { date: "medium", time: "full", en: "Jan 23, 1989, 7:08:09 AM Coordinated Universal Time – Dec 7, 2021, 5:40:50 PM Coordinated Universal Time", ja: "1989/01/23 7時08分09秒 協定世界時~2021/12/07 17時40分50秒 協定世界時" }, - { date: "medium", time: "long", en: "Jan 23, 1989, 7:08:09 AM UTC – Dec 7, 2021, 5:40:50 PM UTC", ja: "1989/01/23 7:08:09 UTC~2021/12/07 17:40:50 UTC" }, - { date: "medium", time: "medium", en: "Jan 23, 1989, 7:08:09 AM – Dec 7, 2021, 5:40:50 PM", ja: "1989/01/23 7:08:09~2021/12/07 17:40:50" }, - { date: "medium", time: "short", en: "Jan 23, 1989, 7:08 AM – Dec 7, 2021, 5:40 PM", ja: "1989/01/23 7:08~2021/12/07 17:40" }, - { date: "short", time: "full", en: "1/23/89, 7:08:09 AM Coordinated Universal Time – 12/7/21, 5:40:50 PM Coordinated Universal Time", ja: "1989/01/23 7時08分09秒 協定世界時~2021/12/07 17時40分50秒 協定世界時" }, - { date: "short", time: "long", en: "1/23/89, 7:08:09 AM UTC – 12/7/21, 5:40:50 PM UTC", ja: "1989/01/23 7:08:09 UTC~2021/12/07 17:40:50 UTC" }, - { date: "short", time: "medium", en: "1/23/89, 7:08:09 AM – 12/7/21, 5:40:50 PM", ja: "1989/01/23 7:08:09~2021/12/07 17:40:50" }, - { date: "short", time: "short", en: "1/23/89, 7:08 AM – 12/7/21, 5:40 PM", ja: "1989/01/23 7:08~2021/12/07 17:40" }, + { date: "full", time: "full", en: "Monday, January 23, 1989 at 7:08:09\u202fAM Coordinated Universal Time\u2009–\u2009Tuesday, December 7, 2021 at 5:40:50\u202fPM Coordinated Universal Time", ja: "1989年1月23日月曜日 7時08分09秒 協定世界時~2021年12月7日火曜日 17時40分50秒 協定世界時" }, + { date: "full", time: "long", en: "Monday, January 23, 1989 at 7:08:09\u202fAM UTC\u2009–\u2009Tuesday, December 7, 2021 at 5:40:50\u202fPM UTC", ja: "1989年1月23日月曜日 7:08:09 UTC~2021年12月7日火曜日 17:40:50 UTC" }, + { date: "full", time: "medium", en: "Monday, January 23, 1989 at 7:08:09\u202fAM\u2009–\u2009Tuesday, December 7, 2021 at 5:40:50\u202fPM", ja: "1989年1月23日月曜日 7:08:09~2021年12月7日火曜日 17:40:50" }, + { date: "full", time: "short", en: "Monday, January 23, 1989 at 7:08\u202fAM\u2009–\u2009Tuesday, December 7, 2021 at 5:40\u202fPM", ja: "1989年1月23日月曜日 7:08~2021年12月7日火曜日 17:40" }, + { date: "long", time: "full", en: "January 23, 1989 at 7:08:09\u202fAM Coordinated Universal Time\u2009–\u2009December 7, 2021 at 5:40:50\u202fPM Coordinated Universal Time", ja: "1989年1月23日 7時08分09秒 協定世界時~2021年12月7日 17時40分50秒 協定世界時" }, + { date: "long", time: "long", en: "January 23, 1989 at 7:08:09\u202fAM UTC\u2009–\u2009December 7, 2021 at 5:40:50\u202fPM UTC", ja: "1989年1月23日 7:08:09 UTC~2021年12月7日 17:40:50 UTC" }, + { date: "long", time: "medium", en: "January 23, 1989 at 7:08:09\u202fAM\u2009–\u2009December 7, 2021 at 5:40:50\u202fPM", ja: "1989年1月23日 7:08:09~2021年12月7日 17:40:50" }, + { date: "long", time: "short", en: "January 23, 1989 at 7:08\u202fAM\u2009–\u2009December 7, 2021 at 5:40\u202fPM", ja: "1989年1月23日 7:08~2021年12月7日 17:40" }, + { date: "medium", time: "full", en: "Jan 23, 1989, 7:08:09\u202fAM Coordinated Universal Time\u2009–\u2009Dec 7, 2021, 5:40:50\u202fPM Coordinated Universal Time", ja: "1989/01/23 7時08分09秒 協定世界時~2021/12/07 17時40分50秒 協定世界時" }, + { date: "medium", time: "long", en: "Jan 23, 1989, 7:08:09\u202fAM UTC\u2009–\u2009Dec 7, 2021, 5:40:50\u202fPM UTC", ja: "1989/01/23 7:08:09 UTC~2021/12/07 17:40:50 UTC" }, + { date: "medium", time: "medium", en: "Jan 23, 1989, 7:08:09\u202fAM\u2009–\u2009Dec 7, 2021, 5:40:50\u202fPM", ja: "1989/01/23 7:08:09~2021/12/07 17:40:50" }, + { date: "medium", time: "short", en: "Jan 23, 1989, 7:08\u202fAM\u2009–\u2009Dec 7, 2021, 5:40\u202fPM", ja: "1989/01/23 7:08~2021/12/07 17:40" }, + { date: "short", time: "full", en: "1/23/89, 7:08:09\u202fAM Coordinated Universal Time\u2009–\u200912/7/21, 5:40:50\u202fPM Coordinated Universal Time", ja: "1989/01/23 7時08分09秒 協定世界時~2021/12/07 17時40分50秒 協定世界時" }, + { date: "short", time: "long", en: "1/23/89, 7:08:09\u202fAM UTC\u2009–\u200912/7/21, 5:40:50\u202fPM UTC", ja: "1989/01/23 7:08:09 UTC~2021/12/07 17:40:50 UTC" }, + { date: "short", time: "medium", en: "1/23/89, 7:08:09\u202fAM\u2009–\u200912/7/21, 5:40:50\u202fPM", ja: "1989/01/23 7:08:09~2021/12/07 17:40:50" }, + { date: "short", time: "short", en: "1/23/89, 7:08\u202fAM\u2009–\u200912/7/21, 5:40\u202fPM", ja: "1989/01/23 7:08~2021/12/07 17:40" }, ]; test("all", () => { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js index 3fb65f8a36..3e7bbd822a 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js @@ -85,7 +85,7 @@ describe("equal dates are squashed", () => { { type: "minute", value: "08", source: "shared" }, { type: "literal", value: ":", source: "shared" }, { type: "second", value: "09", source: "shared" }, - { type: "literal", value: " ", source: "shared" }, + { type: "literal", value: "\u202f", source: "shared" }, { type: "dayPeriod", value: "AM", source: "shared" }, ]); @@ -126,7 +126,7 @@ describe("equal dates are squashed", () => { { type: "minute", value: "08", source: "shared" }, { type: "literal", value: ":", source: "shared" }, { type: "second", value: "09", source: "shared" }, - { type: "literal", value: " ", source: "shared" }, + { type: "literal", value: "\u202f", source: "shared" }, { type: "dayPeriod", value: "AM", source: "shared" }, ]); @@ -174,7 +174,7 @@ describe("equal dates are squashed", () => { { type: "minute", value: "08", source: "shared" }, { type: "literal", value: ":", source: "shared" }, { type: "second", value: "09", source: "shared" }, - { type: "literal", value: " ", source: "shared" }, + { type: "literal", value: "\u202f", source: "shared" }, { type: "dayPeriod", value: "AM", source: "shared" }, ]); @@ -212,7 +212,7 @@ describe("dateStyle", () => { { type: "day", value: "23", source: "startRange" }, { type: "literal", value: ", ", source: "startRange" }, { type: "year", value: "1989", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "weekday", value: "Tuesday", source: "endRange" }, { type: "literal", value: ", ", source: "endRange" }, { type: "month", value: "December", source: "endRange" }, @@ -250,7 +250,7 @@ describe("dateStyle", () => { { type: "day", value: "23", source: "startRange" }, { type: "literal", value: ", ", source: "startRange" }, { type: "year", value: "1989", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "month", value: "December", source: "endRange" }, { type: "literal", value: " ", source: "endRange" }, { type: "day", value: "7", source: "endRange" }, @@ -282,7 +282,7 @@ describe("dateStyle", () => { { type: "day", value: "23", source: "startRange" }, { type: "literal", value: ", ", source: "startRange" }, { type: "year", value: "1989", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "month", value: "Dec", source: "endRange" }, { type: "literal", value: " ", source: "endRange" }, { type: "day", value: "7", source: "endRange" }, @@ -314,7 +314,7 @@ describe("dateStyle", () => { { type: "day", value: "23", source: "startRange" }, { type: "literal", value: "/", source: "startRange" }, { type: "year", value: "89", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "month", value: "12", source: "endRange" }, { type: "literal", value: "/", source: "endRange" }, { type: "day", value: "7", source: "endRange" }, @@ -348,7 +348,7 @@ describe("dateStyle", () => { { type: "day", value: "7", source: "startRange" }, { type: "literal", value: ", ", source: "startRange" }, { type: "year", value: "2021", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "weekday", value: "Monday", source: "endRange" }, { type: "literal", value: ", ", source: "endRange" }, { type: "month", value: "January", source: "endRange" }, @@ -390,17 +390,17 @@ describe("timeStyle", () => { { type: "minute", value: "08", source: "startRange" }, { type: "literal", value: ":", source: "startRange" }, { type: "second", value: "09", source: "startRange" }, - { type: "literal", value: " ", source: "startRange" }, + { type: "literal", value: "\u202f", source: "startRange" }, { type: "dayPeriod", value: "AM", source: "startRange" }, { type: "literal", value: " ", source: "startRange" }, { type: "timeZoneName", value: "Coordinated Universal Time", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "hour", value: "5", source: "endRange" }, { type: "literal", value: ":", source: "endRange" }, { type: "minute", value: "40", source: "endRange" }, { type: "literal", value: ":", source: "endRange" }, { type: "second", value: "50", source: "endRange" }, - { type: "literal", value: " ", source: "endRange" }, + { type: "literal", value: "\u202f", source: "endRange" }, { type: "dayPeriod", value: "PM", source: "endRange" }, { type: "literal", value: " ", source: "endRange" }, { type: "timeZoneName", value: "Coordinated Universal Time", source: "endRange" }, @@ -434,17 +434,17 @@ describe("timeStyle", () => { { type: "minute", value: "08", source: "startRange" }, { type: "literal", value: ":", source: "startRange" }, { type: "second", value: "09", source: "startRange" }, - { type: "literal", value: " ", source: "startRange" }, + { type: "literal", value: "\u202f", source: "startRange" }, { type: "dayPeriod", value: "AM", source: "startRange" }, { type: "literal", value: " ", source: "startRange" }, { type: "timeZoneName", value: "UTC", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "hour", value: "5", source: "endRange" }, { type: "literal", value: ":", source: "endRange" }, { type: "minute", value: "40", source: "endRange" }, { type: "literal", value: ":", source: "endRange" }, { type: "second", value: "50", source: "endRange" }, - { type: "literal", value: " ", source: "endRange" }, + { type: "literal", value: "\u202f", source: "endRange" }, { type: "dayPeriod", value: "PM", source: "endRange" }, { type: "literal", value: " ", source: "endRange" }, { type: "timeZoneName", value: "UTC", source: "endRange" }, @@ -478,15 +478,15 @@ describe("timeStyle", () => { { type: "minute", value: "08", source: "startRange" }, { type: "literal", value: ":", source: "startRange" }, { type: "second", value: "09", source: "startRange" }, - { type: "literal", value: " ", source: "startRange" }, + { type: "literal", value: "\u202f", source: "startRange" }, { type: "dayPeriod", value: "AM", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "hour", value: "5", source: "endRange" }, { type: "literal", value: ":", source: "endRange" }, { type: "minute", value: "40", source: "endRange" }, { type: "literal", value: ":", source: "endRange" }, { type: "second", value: "50", source: "endRange" }, - { type: "literal", value: " ", source: "endRange" }, + { type: "literal", value: "\u202f", source: "endRange" }, { type: "dayPeriod", value: "PM", source: "endRange" }, ]); @@ -512,13 +512,13 @@ describe("timeStyle", () => { { type: "hour", value: "7", source: "startRange" }, { type: "literal", value: ":", source: "startRange" }, { type: "minute", value: "08", source: "startRange" }, - { type: "literal", value: " ", source: "startRange" }, + { type: "literal", value: "\u202f", source: "startRange" }, { type: "dayPeriod", value: "AM", source: "startRange" }, - { type: "literal", value: " – ", source: "shared" }, + { type: "literal", value: "\u2009–\u2009", source: "shared" }, { type: "hour", value: "5", source: "endRange" }, { type: "literal", value: ":", source: "endRange" }, { type: "minute", value: "40", source: "endRange" }, - { type: "literal", value: " ", source: "endRange" }, + { type: "literal", value: "\u202f", source: "endRange" }, { type: "dayPeriod", value: "PM", source: "endRange" }, ]); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js index 86d9e0d9fb..f2e8b362c7 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js @@ -127,7 +127,7 @@ describe("timeStyle", () => { { type: "minute", value: "08" }, { type: "literal", value: ":" }, { type: "second", value: "09" }, - { type: "literal", value: " " }, + { type: "literal", value: "\u202f" }, { type: "dayPeriod", value: "AM" }, { type: "literal", value: " " }, { type: "timeZoneName", value: "Coordinated Universal Time" }, @@ -155,7 +155,7 @@ describe("timeStyle", () => { { type: "minute", value: "08" }, { type: "literal", value: ":" }, { type: "second", value: "09" }, - { type: "literal", value: " " }, + { type: "literal", value: "\u202f" }, { type: "dayPeriod", value: "AM" }, { type: "literal", value: " " }, { type: "timeZoneName", value: "UTC" }, @@ -183,7 +183,7 @@ describe("timeStyle", () => { { type: "minute", value: "08" }, { type: "literal", value: ":" }, { type: "second", value: "09" }, - { type: "literal", value: " " }, + { type: "literal", value: "\u202f" }, { type: "dayPeriod", value: "AM" }, ]); @@ -205,7 +205,7 @@ describe("timeStyle", () => { { type: "hour", value: "7" }, { type: "literal", value: ":" }, { type: "minute", value: "08" }, - { type: "literal", value: " " }, + { type: "literal", value: "\u202f" }, { type: "dayPeriod", value: "AM" }, ]); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js index 1d83add971..406c508b54 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.prototype.of.js @@ -52,8 +52,8 @@ describe("correct behavior", () => { { locale: "en-US", en: "American English", es419: "inglés estadounidense", zhHant: "英文(美國)" }, { locale: "en-GB", en: "British English", es419: "inglés británico", zhHant: "英文(英國)" }, { locale: "sr", en: "Serbian", es419: "serbio", zhHant: "塞爾維亞文" }, - { locale: "sr-Cyrl", en: "Serbian (Cyrillic)", es419: "serbio (cirílico)", zhHant: "塞爾維亞文(斯拉夫文)" }, - { locale: "sr-Cyrl-BA", en: "Serbian (Cyrillic, Bosnia & Herzegovina)", es419: "serbio (cirílico, Bosnia-Herzegovina)", zhHant: "塞爾維亞文(斯拉夫文,波士尼亞與赫塞哥維納)" }, + { locale: "sr-Cyrl", en: "Serbian (Cyrillic)", es419: "serbio (cirílico)", zhHant: "塞爾維亞文(西里爾文字)" }, + { locale: "sr-Cyrl-BA", en: "Serbian (Cyrillic, Bosnia & Herzegovina)", es419: "serbio (cirílico, Bosnia-Herzegovina)", zhHant: "塞爾維亞文(西里爾文字,波士尼亞與赫塞哥維納)" }, ]; const en = new Intl.DisplayNames("en", { type: "language", languageDisplay: "dialect" }); @@ -80,8 +80,8 @@ describe("correct behavior", () => { { locale: "en-US", en: "English (United States)", es419: "inglés (Estados Unidos)", zhHant: "英文(美國)" }, { locale: "en-GB", en: "English (United Kingdom)", es419: "inglés (Reino Unido)", zhHant: "英文(英國)" }, { locale: "sr", en: "Serbian", es419: "serbio", zhHant: "塞爾維亞文" }, - { locale: "sr-Cyrl", en: "Serbian (Cyrillic)", es419: "serbio (cirílico)", zhHant: "塞爾維亞文(斯拉夫文)" }, - { locale: "sr-Cyrl-BA", en: "Serbian (Cyrillic, Bosnia & Herzegovina)", es419: "serbio (cirílico, Bosnia-Herzegovina)", zhHant: "塞爾維亞文(斯拉夫文,波士尼亞與赫塞哥維納)" }, + { locale: "sr-Cyrl", en: "Serbian (Cyrillic)", es419: "serbio (cirílico)", zhHant: "塞爾維亞文(西里爾文字)" }, + { locale: "sr-Cyrl-BA", en: "Serbian (Cyrillic, Bosnia & Herzegovina)", es419: "serbio (cirílico, Bosnia-Herzegovina)", zhHant: "塞爾維亞文(西里爾文字,波士尼亞與赫塞哥維納)" }, ]; const en = new Intl.DisplayNames("en", { type: "language", languageDisplay: "standard" }); @@ -189,10 +189,10 @@ describe("correct behavior", () => { { calendar: "hebrew", en: "Hebrew Calendar", es419: "calendario hebreo", zhHant: "希伯來曆" }, { calendar: "indian", en: "Indian National Calendar", es419: "calendario nacional hindú", zhHant: "印度國曆" }, { calendar: "islamic", en: "Islamic Calendar", es419: "calendario islámico", zhHant: "伊斯蘭曆" }, - { calendar: "islamic-civil", en: "Islamic Calendar (tabular, civil epoch)", es419: "calendario civil islámico", zhHant: "伊斯蘭民用曆" }, + { calendar: "islamic-civil", en: "Islamic Calendar (tabular, civil epoch)", es419: "calendario islámico tabular", zhHant: "伊斯蘭民用曆" }, { calendar: "islamic-rgsa", en: "Islamic Calendar (Saudi Arabia, sighting)", es419: "calendario islámico (Arabia Saudita)", zhHant: "伊斯蘭新月曆" }, { calendar: "islamic-tbla", en: "Islamic Calendar (tabular, astronomical epoch)", es419: "calendario islámico tabular", zhHant: "伊斯蘭天文曆" }, - { calendar: "islamic-umalqura", en: "Islamic Calendar (Umm al-Qura)", es419: "calendario islámico umalqura", zhHant: "烏姆庫拉曆" }, + { calendar: "islamic-umalqura", en: "Islamic Calendar (Umm al-Qura)", es419: "calendario islámico Umm al-Qura", zhHant: "烏姆庫拉曆" }, { calendar: "iso8601", en: "ISO-8601 Calendar", es419: "calendario ISO-8601", zhHant: "ISO 8601 國際曆法" }, { calendar: "japanese", en: "Japanese Calendar", es419: "calendario japonés", zhHant: "日本曆" }, { calendar: "persian", en: "Persian Calendar", es419: "calendario persa", zhHant: "波斯曆" }, @@ -220,7 +220,7 @@ describe("correct behavior", () => { { dateTimeField: "weekOfYear", en: "week", es419: "semana", zhHant: "週" }, { dateTimeField: "weekday", en: "day of the week", es419: "día de la semana", zhHant: "週天" }, { dateTimeField: "day", en: "day", es419: "día", zhHant: "日" }, - { dateTimeField: "dayPeriod", en: "AM/PM", es419: "a. m./p. m.", zhHant: "上午/下午" }, + { dateTimeField: "dayPeriod", en: "AM/PM", es419: "a.m./p.m.", zhHant: "上午/下午" }, { dateTimeField: "hour", en: "hour", es419: "hora", zhHant: "小時" }, { dateTimeField: "minute", en: "minute", es419: "minuto", zhHant: "分鐘" }, { dateTimeField: "second", en: "second", es419: "segundo", zhHant: "秒" }, @@ -270,16 +270,16 @@ describe("correct behavior", () => { // prettier-ignore const data = [ { dateTimeField: "era", en: "era", es419: "era", zhHant: "年代" }, - { dateTimeField: "year", en: "yr.", es419: "a", zhHant: "年" }, - { dateTimeField: "quarter", en: "qtr.", es419: "trim.", zhHant: "季" }, - { dateTimeField: "month", en: "mo.", es419: "m", zhHant: "月" }, - { dateTimeField: "weekOfYear", en: "wk.", es419: "sem.", zhHant: "週" }, + { dateTimeField: "year", en: "yr", es419: "a", zhHant: "年" }, + { dateTimeField: "quarter", en: "qtr", es419: "trim.", zhHant: "季" }, + { dateTimeField: "month", en: "mo", es419: "m", zhHant: "月" }, + { dateTimeField: "weekOfYear", en: "wk", es419: "sem.", zhHant: "週" }, { dateTimeField: "weekday", en: "day of wk.", es419: "día de sem.", zhHant: "週天" }, { dateTimeField: "day", en: "day", es419: "d", zhHant: "日" }, { dateTimeField: "dayPeriod", en: "AM/PM", es419: "a.m./p.m.", zhHant: "上午/下午" }, - { dateTimeField: "hour", en: "hr.", es419: "h", zhHant: "小時" }, - { dateTimeField: "minute", en: "min.", es419: "min", zhHant: "分鐘" }, - { dateTimeField: "second", en: "sec.", es419: "s", zhHant: "秒" }, + { dateTimeField: "hour", en: "hr", es419: "h", zhHant: "小時" }, + { dateTimeField: "minute", en: "min", es419: "min", zhHant: "分鐘" }, + { dateTimeField: "second", en: "sec", es419: "s", zhHant: "秒" }, { dateTimeField: "timeZoneName", en: "zone", es419: "zona", zhHant: "時區" }, ]; diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js index 3ebd36f465..68d2d22f36 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js @@ -1153,9 +1153,9 @@ describe("style=currency", () => { currency: "USD", currencyDisplay: "code", }); - expect(ar1.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0USD"); - expect(ar1.format(1.2)).toBe("\u0661\u066b\u0662\u0660\u00a0USD"); - expect(ar1.format(1.23)).toBe("\u0661\u066b\u0662\u0663\u00a0USD"); + expect(ar1.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0USD"); + expect(ar1.format(1.2)).toBe("\u200f\u0661\u066b\u0662\u0660\u00a0USD"); + expect(ar1.format(1.23)).toBe("\u200f\u0661\u066b\u0662\u0663\u00a0USD"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1163,9 +1163,9 @@ describe("style=currency", () => { currencyDisplay: "code", numberingSystem: "latn", }); - expect(ar2.format(1)).toBe("USD\u00a01.00"); - expect(ar2.format(1.2)).toBe("USD\u00a01.20"); - expect(ar2.format(1.23)).toBe("USD\u00a01.23"); + expect(ar2.format(1)).toBe("\u200f1.00\u00a0USD"); + expect(ar2.format(1.2)).toBe("\u200f1.20\u00a0USD"); + expect(ar2.format(1.23)).toBe("\u200f1.23\u00a0USD"); }); test("currencyDisplay=symbol", () => { @@ -1192,9 +1192,9 @@ describe("style=currency", () => { currency: "USD", currencyDisplay: "symbol", }); - expect(ar1.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(1.2)).toBe("\u0661\u066b\u0662\u0660\u00a0US$"); - expect(ar1.format(1.23)).toBe("\u0661\u066b\u0662\u0663\u00a0US$"); + expect(ar1.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(1.2)).toBe("\u200f\u0661\u066b\u0662\u0660\u00a0US$"); + expect(ar1.format(1.23)).toBe("\u200f\u0661\u066b\u0662\u0663\u00a0US$"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1202,9 +1202,9 @@ describe("style=currency", () => { currencyDisplay: "symbol", numberingSystem: "latn", }); - expect(ar2.format(1)).toBe("US$\u00a01.00"); - expect(ar2.format(1.2)).toBe("US$\u00a01.20"); - expect(ar2.format(1.23)).toBe("US$\u00a01.23"); + expect(ar2.format(1)).toBe("\u200f1.00\u00a0US$"); + expect(ar2.format(1.2)).toBe("\u200f1.20\u00a0US$"); + expect(ar2.format(1.23)).toBe("\u200f1.23\u00a0US$"); }); test("currencyDisplay=narrowSymbol", () => { @@ -1231,9 +1231,9 @@ describe("style=currency", () => { currency: "USD", currencyDisplay: "narrowSymbol", }); - expect(ar1.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(1.2)).toBe("\u0661\u066b\u0662\u0660\u00a0US$"); - expect(ar1.format(1.23)).toBe("\u0661\u066b\u0662\u0663\u00a0US$"); + expect(ar1.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(1.2)).toBe("\u200f\u0661\u066b\u0662\u0660\u00a0US$"); + expect(ar1.format(1.23)).toBe("\u200f\u0661\u066b\u0662\u0663\u00a0US$"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1241,9 +1241,9 @@ describe("style=currency", () => { currencyDisplay: "narrowSymbol", numberingSystem: "latn", }); - expect(ar2.format(1)).toBe("US$\u00a01.00"); - expect(ar2.format(1.2)).toBe("US$\u00a01.20"); - expect(ar2.format(1.23)).toBe("US$\u00a01.23"); + expect(ar2.format(1)).toBe("\u200f1.00\u00a0US$"); + expect(ar2.format(1.2)).toBe("\u200f1.20\u00a0US$"); + expect(ar2.format(1.23)).toBe("\u200f1.23\u00a0US$"); }); test("currencyDisplay=name", () => { @@ -1308,8 +1308,8 @@ describe("style=currency", () => { currency: "USD", signDisplay: "never", }); - expect(ar1.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1317,8 +1317,8 @@ describe("style=currency", () => { currencySign: "accounting", signDisplay: "never", }); - expect(ar2.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); }); test("signDisplay=auto", () => { @@ -1348,10 +1348,10 @@ describe("style=currency", () => { currency: "USD", signDisplay: "auto", }); - expect(ar1.format(0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-0)).toBe("\u061c-\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-0)).toBe("\u061c-\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1359,10 +1359,10 @@ describe("style=currency", () => { currencySign: "accounting", signDisplay: "auto", }); - expect(ar2.format(0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-0)).toBe("\u061c-\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-0)).toBe("\u061c-\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); }); test("signDisplay=always", () => { @@ -1392,10 +1392,10 @@ describe("style=currency", () => { currency: "USD", signDisplay: "always", }); - expect(ar1.format(0)).toBe("\u061c+\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(1)).toBe("\u061c+\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-0)).toBe("\u061c-\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(0)).toBe("\u061c+\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(1)).toBe("\u061c+\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-0)).toBe("\u061c-\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1403,10 +1403,10 @@ describe("style=currency", () => { currencySign: "accounting", signDisplay: "always", }); - expect(ar2.format(0)).toBe("\u061c+\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(1)).toBe("\u061c+\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-0)).toBe("\u061c-\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(0)).toBe("\u061c+\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(1)).toBe("\u061c+\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-0)).toBe("\u061c-\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); }); test("signDisplay=exceptZero", () => { @@ -1436,10 +1436,10 @@ describe("style=currency", () => { currency: "USD", signDisplay: "exceptZero", }); - expect(ar1.format(0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(1)).toBe("\u061c+\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(1)).toBe("\u061c+\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1447,10 +1447,10 @@ describe("style=currency", () => { currencySign: "accounting", signDisplay: "exceptZero", }); - expect(ar2.format(0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(1)).toBe("\u061c+\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(1)).toBe("\u061c+\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); }); test("signDisplay=negative", () => { @@ -1480,10 +1480,10 @@ describe("style=currency", () => { currency: "USD", signDisplay: "negative", }); - expect(ar1.format(0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar1.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar1.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); const ar2 = new Intl.NumberFormat("ar", { style: "currency", @@ -1491,10 +1491,10 @@ describe("style=currency", () => { currencySign: "accounting", signDisplay: "negative", }); - expect(ar2.format(0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(1)).toBe("\u0661\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-0)).toBe("\u0660\u066b\u0660\u0660\u00a0US$"); - expect(ar2.format(-1)).toBe("\u061c-\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(1)).toBe("\u200f\u0661\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-0)).toBe("\u200f\u0660\u066b\u0660\u0660\u00a0US$"); + expect(ar2.format(-1)).toBe("\u061c-\u200f\u0661\u066b\u0660\u0660\u00a0US$"); }); }); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js index f5c9529057..fc17f34dd2 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js @@ -678,6 +678,7 @@ describe("style=currency", () => { currencyDisplay: "code", }); expect(ar.formatToParts(1)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -685,6 +686,7 @@ describe("style=currency", () => { { type: "currency", value: "USD" }, ]); expect(ar.formatToParts(1.23)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0662\u0663" }, @@ -718,6 +720,7 @@ describe("style=currency", () => { currencyDisplay: "symbol", }); expect(ar.formatToParts(1)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -725,6 +728,7 @@ describe("style=currency", () => { { type: "currency", value: "US$" }, ]); expect(ar.formatToParts(1.23)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0662\u0663" }, @@ -758,6 +762,7 @@ describe("style=currency", () => { currencyDisplay: "narrowSymbol", }); expect(ar.formatToParts(1)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -765,6 +770,7 @@ describe("style=currency", () => { { type: "currency", value: "US$" }, ]); expect(ar.formatToParts(1.23)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0662\u0663" }, @@ -840,6 +846,7 @@ describe("style=currency", () => { signDisplay: "never", }); expect(ar.formatToParts(1)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -847,6 +854,7 @@ describe("style=currency", () => { { type: "currency", value: "US$" }, ]); expect(ar.formatToParts(-1)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -913,6 +921,7 @@ describe("style=currency", () => { signDisplay: "auto", }); expect(ar.formatToParts(0)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -920,6 +929,7 @@ describe("style=currency", () => { { type: "currency", value: "US$" }, ]); expect(ar.formatToParts(1)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -928,6 +938,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(-0)).toEqual([ { type: "minusSign", value: "\u061c-" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -936,6 +947,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(-1)).toEqual([ { type: "minusSign", value: "\u061c-" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1021,6 +1033,7 @@ describe("style=currency", () => { }); expect(ar.formatToParts(0)).toEqual([ { type: "plusSign", value: "\u061c+" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1029,6 +1042,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(1)).toEqual([ { type: "plusSign", value: "\u061c+" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1037,6 +1051,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(-0)).toEqual([ { type: "minusSign", value: "\u061c-" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1045,6 +1060,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(-1)).toEqual([ { type: "minusSign", value: "\u061c-" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1129,6 +1145,7 @@ describe("style=currency", () => { signDisplay: "exceptZero", }); expect(ar.formatToParts(0)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1137,6 +1154,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(1)).toEqual([ { type: "plusSign", value: "\u061c+" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1144,6 +1162,7 @@ describe("style=currency", () => { { type: "currency", value: "US$" }, ]); expect(ar.formatToParts(-0)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1152,6 +1171,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(-1)).toEqual([ { type: "minusSign", value: "\u061c-" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1232,6 +1252,7 @@ describe("style=currency", () => { signDisplay: "negative", }); expect(ar.formatToParts(0)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1239,6 +1260,7 @@ describe("style=currency", () => { { type: "currency", value: "US$" }, ]); expect(ar.formatToParts(1)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1246,6 +1268,7 @@ describe("style=currency", () => { { type: "currency", value: "US$" }, ]); expect(ar.formatToParts(-0)).toEqual([ + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0660" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, @@ -1254,6 +1277,7 @@ describe("style=currency", () => { ]); expect(ar.formatToParts(-1)).toEqual([ { type: "minusSign", value: "\u061c-" }, + { type: "literal", value: "\u200f" }, { type: "integer", value: "\u0661" }, { type: "decimal", value: "\u066b" }, { type: "fraction", value: "\u0660\u0660" }, diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.select.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.select.js index ea284da38c..06099aba50 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.select.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.select.js @@ -41,17 +41,22 @@ describe("correct behavior", () => { expect(en.select(3)).toBe("other"); // In "he": - // "many" is specified to be integers larger than 10 which are multiples of 10. + // "one" is specified to be the integer 1, and non-integers whose integer part is 0. + // "two" is specified to be the integer 2. const he = new Intl.PluralRules("he", { type: "cardinal" }); expect(he.select(0)).toBe("other"); expect(he.select(1)).toBe("one"); - expect(en.select(2)).toBe("other"); + expect(he.select(0.1)).toBe("one"); + expect(he.select(0.2)).toBe("one"); + expect(he.select(0.8)).toBe("one"); + expect(he.select(0.9)).toBe("one"); + expect(he.select(2)).toBe("two"); expect(he.select(10)).toBe("other"); expect(he.select(19)).toBe("other"); - expect(he.select(20)).toBe("many"); + expect(he.select(20)).toBe("other"); expect(he.select(21)).toBe("other"); expect(he.select(29)).toBe("other"); - expect(he.select(30)).toBe("many"); + expect(he.select(30)).toBe("other"); expect(he.select(31)).toBe("other"); // In "pl": diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.format.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.format.js index 6f4b25fede..44c58074e6 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.format.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.format.js @@ -99,7 +99,7 @@ describe("second", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 sec. ago", "1 sec. ago", "0 sec. ago", "in 0 sec.", "in 1 sec.", "in 2 sec." ]; // prettier-ignore + const en = [ "2s ago", "1s ago", "0s ago", "in 0s", "in 1s", "in 2s" ]; // prettier-ignore const ar = [ "قبل ثانيتين", "قبل ثانية واحدة", "قبل ٠ ثانية", "خلال ٠ ثانية", "خلال ثانية واحدة", "خلال ثانيتين" ]; // prettier-ignore const pl = [ "2 s temu", "1 s temu", "0 s temu", "za 0 s", "za 1 s", "za 2 s" ]; // prettier-ignore @@ -123,7 +123,7 @@ describe("second", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 sec. ago", "1 sec. ago", "now", "now", "in 1 sec.", "in 2 sec." ]; // prettier-ignore + const en = [ "2s ago", "1s ago", "now", "now", "in 1s", "in 2s" ]; // prettier-ignore const ar = [ "قبل ثانيتين", "قبل ثانية واحدة", "الآن", "الآن", "خلال ثانية واحدة", "خلال ثانيتين" ]; // prettier-ignore const pl = [ "2 s temu", "1 s temu", "teraz", "teraz", "za 1 s", "za 2 s" ]; // prettier-ignore @@ -149,7 +149,7 @@ describe("minute", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 min. ago", "1 min. ago", "0 min. ago", "in 0 min.", "in 1 min.", "in 2 min." ]; // prettier-ignore + const en = [ "2m ago", "1m ago", "0m ago", "in 0m", "in 1m", "in 2m" ]; // prettier-ignore const ar = [ "قبل دقيقتين", "قبل دقيقة واحدة", "قبل ٠ دقيقة", "خلال ٠ دقيقة", "خلال دقيقة واحدة", "خلال دقيقتين" ]; // prettier-ignore const pl = [ "2 min temu", "1 min temu", "0 min temu", "za 0 min", "za 1 min", "za 2 min" ]; // prettier-ignore @@ -173,7 +173,7 @@ describe("minute", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 min. ago", "1 min. ago", "this minute", "this minute", "in 1 min.", "in 2 min." ]; // prettier-ignore + const en = [ "2m ago", "1m ago", "this minute", "this minute", "in 1m", "in 2m" ]; // prettier-ignore const ar = [ "قبل دقيقتين", "قبل دقيقة واحدة", "هذه الدقيقة", "هذه الدقيقة", "خلال دقيقة واحدة", "خلال دقيقتين" ]; // prettier-ignore const pl = [ "2 min temu", "1 min temu", "ta minuta", "ta minuta", "za 1 min", "za 2 min" ]; // prettier-ignore @@ -199,7 +199,7 @@ describe("hour", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 hr. ago", "1 hr. ago", "0 hr. ago", "in 0 hr.", "in 1 hr.", "in 2 hr." ]; // prettier-ignore + const en = [ "2h ago", "1h ago", "0h ago", "in 0h", "in 1h", "in 2h" ]; // prettier-ignore const ar = [ "قبل ساعتين", "قبل ساعة واحدة", "قبل ٠ ساعة", "خلال ٠ ساعة", "خلال ساعة واحدة", "خلال ساعتين" ]; // prettier-ignore const pl = [ "2 g. temu", "1 g. temu", "0 g. temu", "za 0 g.", "za 1 g.", "za 2 g." ]; // prettier-ignore @@ -223,7 +223,7 @@ describe("hour", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 hr. ago", "1 hr. ago", "this hour", "this hour", "in 1 hr.", "in 2 hr." ]; // prettier-ignore + const en = [ "2h ago", "1h ago", "this hour", "this hour", "in 1h", "in 2h" ]; // prettier-ignore const ar = [ "قبل ساعتين", "قبل ساعة واحدة", "الساعة الحالية", "الساعة الحالية", "خلال ساعة واحدة", "خلال ساعتين" ]; // prettier-ignore const pl = [ "2 g. temu", "1 g. temu", "ta godzina", "ta godzina", "za 1 g.", "za 2 g." ]; // prettier-ignore @@ -249,7 +249,7 @@ describe("day", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 days ago", "1 day ago", "0 days ago", "in 0 days", "in 1 day", "in 2 days" ]; // prettier-ignore + const en = [ "2d ago", "1d ago", "0d ago", "in 0d", "in 1d", "in 2d" ]; // prettier-ignore const ar = [ "قبل يومين", "قبل يوم واحد", "قبل ٠ يوم", "خلال ٠ يوم", "خلال يوم واحد", "خلال يومين" ]; // prettier-ignore const pl = [ "2 dni temu", "1 dzień temu", "0 dni temu", "za 0 dni", "za 1 dzień", "za 2 dni" ]; // prettier-ignore @@ -273,7 +273,7 @@ describe("day", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 days ago", "yesterday", "today", "today", "tomorrow", "in 2 days" ]; // prettier-ignore + const en = [ "2d ago", "yesterday", "today", "today", "tomorrow", "in 2d" ]; // prettier-ignore const ar = [ "أول أمس", "أمس", "اليوم", "اليوم", "غدًا", "بعد الغد" ]; // prettier-ignore const pl = [ "przedwczoraj", "wcz.", "dziś", "dziś", "jutro", "pojutrze" ]; // prettier-ignore @@ -299,7 +299,7 @@ describe("week", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 wk. ago", "1 wk. ago", "0 wk. ago", "in 0 wk.", "in 1 wk.", "in 2 wk." ]; // prettier-ignore + const en = [ "2w ago", "1w ago", "0w ago", "in 0w", "in 1w", "in 2w" ]; // prettier-ignore const ar = [ "قبل أسبوعين", "قبل أسبوع واحد", "قبل ٠ أسبوع", "خلال ٠ أسبوع", "خلال أسبوع واحد", "خلال أسبوعين" ]; // prettier-ignore const pl = [ "2 tyg. temu", "1 tydz. temu", "0 tyg. temu", "za 0 tyg.", "za 1 tydz.", "za 2 tyg." ]; // prettier-ignore @@ -323,7 +323,7 @@ describe("week", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 wk. ago", "last wk.", "this wk.", "this wk.", "next wk.", "in 2 wk." ]; // prettier-ignore + const en = [ "2w ago", "last wk.", "this wk.", "this wk.", "next wk.", "in 2w" ]; // prettier-ignore const ar = [ "قبل أسبوعين", "الأسبوع الماضي", "هذا الأسبوع", "هذا الأسبوع", "الأسبوع القادم", "خلال أسبوعين" ]; // prettier-ignore const pl = [ "2 tyg. temu", "w zeszłym tyg.", "w tym tyg.", "w tym tyg.", "w przyszłym tyg.", "za 2 tyg." ]; // prettier-ignore @@ -349,7 +349,7 @@ describe("month", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 mo. ago", "1 mo. ago", "0 mo. ago", "in 0 mo.", "in 1 mo.", "in 2 mo." ]; // prettier-ignore + const en = [ "2mo ago", "1mo ago", "0mo ago", "in 0mo", "in 1mo", "in 2mo" ]; // prettier-ignore const ar = [ "قبل شهرين", "قبل شهر واحد", "قبل ٠ شهر", "خلال ٠ شهر", "خلال شهر واحد", "خلال شهرين" ]; // prettier-ignore const pl = [ "2 mies. temu", "1 mies. temu", "0 mies. temu", "za 0 mies.", "za 1 mies.", "za 2 mies." ]; // prettier-ignore @@ -373,7 +373,7 @@ describe("month", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 mo. ago", "last mo.", "this mo.", "this mo.", "next mo.", "in 2 mo." ]; // prettier-ignore + const en = [ "2mo ago", "last mo.", "this mo.", "this mo.", "next mo.", "in 2mo" ]; // prettier-ignore const ar = [ "قبل شهرين", "الشهر الماضي", "هذا الشهر", "هذا الشهر", "الشهر القادم", "خلال شهرين" ]; // prettier-ignore const pl = [ "2 mies. temu", "w zeszłym mies.", "w tym mies.", "w tym mies.", "w przyszłym mies.", "za 2 mies." ]; // prettier-ignore @@ -399,7 +399,7 @@ describe("quarter", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 qtrs. ago", "1 qtr. ago", "0 qtrs. ago", "in 0 qtrs.", "in 1 qtr.", "in 2 qtrs." ]; // prettier-ignore + const en = [ "2q ago", "1q ago", "0q ago", "in 0q", "in 1q", "in 2q" ]; // prettier-ignore const ar = [ "قبل ربعي سنة", "قبل ربع سنة واحد", "قبل ٠ ربع سنة", "خلال ٠ ربع سنة", "خلال ربع سنة واحد", "خلال ربعي سنة" ]; // prettier-ignore const pl = [ "2 kw. temu", "1 kw. temu", "0 kw. temu", "za 0 kw.", "za 1 kw.", "za 2 kw." ]; // prettier-ignore @@ -423,7 +423,7 @@ describe("quarter", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 qtrs. ago", "last qtr.", "this qtr.", "this qtr.", "next qtr.", "in 2 qtrs." ]; // prettier-ignore + const en = [ "2q ago", "last qtr.", "this qtr.", "this qtr.", "next qtr.", "in 2q" ]; // prettier-ignore const ar = [ "قبل ربعي سنة", "الربع الأخير", "هذا الربع", "هذا الربع", "الربع القادم", "خلال ربعي سنة" ]; // prettier-ignore const pl = [ "2 kw. temu", "w zeszłym kwartale", "w tym kwartale", "w tym kwartale", "w przyszłym kwartale", "za 2 kw." ]; // prettier-ignore @@ -449,7 +449,7 @@ describe("year", () => { }); test("style=narrow, numeric=always", () => { - const en = [ "2 yr. ago", "1 yr. ago", "0 yr. ago", "in 0 yr.", "in 1 yr.", "in 2 yr." ]; // prettier-ignore + const en = [ "2y ago", "1y ago", "0y ago", "in 0y", "in 1y", "in 2y" ]; // prettier-ignore const ar = [ "قبل سنتين", "قبل سنة واحدة", "قبل ٠ سنة", "خلال ٠ سنة", "خلال سنة واحدة", "خلال سنتين" ]; // prettier-ignore const pl = [ "2 lata temu", "1 rok temu", "0 lat temu", "za 0 lat", "za 1 rok", "za 2 lata" ]; // prettier-ignore @@ -473,7 +473,7 @@ describe("year", () => { }); test("style=narrow, numeric=auto", () => { - const en = [ "2 yr. ago", "last yr.", "this yr.", "this yr.", "next yr.", "in 2 yr." ]; // prettier-ignore + const en = [ "2y ago", "last yr.", "this yr.", "this yr.", "next yr.", "in 2y" ]; // prettier-ignore const ar = [ "قبل سنتين", "السنة الماضية", "السنة الحالية", "السنة الحالية", "السنة القادمة", "خلال سنتين" ]; // prettier-ignore const pl = [ "2 lata temu", "w zeszłym roku", "w tym roku", "w tym roku", "w przyszłym roku", "za 2 lata" ]; // prettier-ignore