From 9946ac18776d67a78d5f40529cf3b7b3c3759d1b Mon Sep 17 00:00:00 2001 From: Ben Elan Date: Wed, 22 Nov 2023 11:09:59 -0800 Subject: [PATCH] refactor(i18n)!: reduce list of supported numbering systems (#8217) **Related Issue:** #8216 ## Summary Reduce the list of supported numbering systems to `arab`, `arabext`, and `latn` after a discussion in the Internationalization Teams channel. BREAKING CHANGE: Removed support for the following numbering systems: `bali`, `beng`, `deva`, `fullwide`, `gujr`, `guru`, `hanidec`, `khmr`, `knda`, `laoo`, `limb`, `mlym`, `mong`, `mymr`, `orya`, `tamldec`, `telu`, `thai`, `tibt` --------- Co-authored-by: JC Franco --- .../date-picker/date-picker.stories.ts | 11 ------- .../input-date-picker.stories.ts | 3 +- .../input-number/input-number.stories.ts | 20 ++---------- .../input-time-picker.e2e.ts | 10 +++--- .../src/components/input/input.stories.ts | 3 -- .../src/components/stepper/stepper.e2e.ts | 13 +++++--- .../components/text-area/text-area.stories.ts | 10 ++---- .../src/demos/_assets/locales.ts | 16 ---------- .../src/demos/date-picker.html | 31 +++---------------- .../calcite-components/src/utils/locale.ts | 25 +-------------- 10 files changed, 24 insertions(+), 118 deletions(-) diff --git a/packages/calcite-components/src/components/date-picker/date-picker.stories.ts b/packages/calcite-components/src/components/date-picker/date-picker.stories.ts index 3a0687ad5e5..d994e68371a 100644 --- a/packages/calcite-components/src/components/date-picker/date-picker.stories.ts +++ b/packages/calcite-components/src/components/date-picker/date-picker.stories.ts @@ -241,17 +241,6 @@ arabLangNumberingSystem_TestOnly.parameters = { chromatic: { diffThreshold: 1 }, }; -export const thaiLangNumberingSystem_TestOnly = (): string => - html`
- ${create( - "calcite-date-picker", - createAttributes({ exceptions: ["lang", "numberingSystem"] }).concat([ - { name: "lang", value: "th" }, - { name: "numbering-system", value: "thai" }, - ]) - )} -
`; - export const widthSetToBreakpoints_TestOnly = (): string => createBreakpointStories(html``); diff --git a/packages/calcite-components/src/components/input-date-picker/input-date-picker.stories.ts b/packages/calcite-components/src/components/input-date-picker/input-date-picker.stories.ts index 78295b5c3fa..726bfe66d89 100644 --- a/packages/calcite-components/src/components/input-date-picker/input-date-picker.stories.ts +++ b/packages/calcite-components/src/components/input-date-picker/input-date-picker.stories.ts @@ -66,13 +66,12 @@ export const flipPlacements_TestOnly = (): string => html` `; -export const laoNumberingSystemAndMediumIconForLargeInput_TestOnly = (): string => html` +export const mediumIconForLargeInput_TestOnly = (): string => html`
html` `; darkModeRTL_TestOnly.parameters = { modes: modesDarkDefault }; -export const hebrewNumberingSystemAndMediumIconForLargeInputStyling_TestOnly = (): string => +export const mediumIconForLargeInputStyling_TestOnly = (): string => html` - - { expect(inputTimePickerValue).toBe(expectedValue); }); - it("value displays correctly in the input when it is directly changed for a 24-hour language when a default value is present (thai lang/numberingSystem)", async () => { - const locale = "th"; - const numberingSystem = "thai"; + it("value displays correctly in the input when it is directly changed for a 24-hour language when a default value is present (arab lang/numberingSystem)", async () => { + const locale = "ar"; + const numberingSystem = "arab"; const initialValue = "11:00:00"; const page = await newE2EPage(); @@ -665,11 +665,11 @@ describe("calcite-input-time-picker", () => { expect(await getInputValue(page)).toBe("٠٢:٣٠:٢٥ م"); inputTimePicker.setProperty("lang", "zh-HK"); - inputTimePicker.setProperty("numberingSystem", "hanidec"); + inputTimePicker.setProperty("numberingSystem", "latn"); await page.waitForChanges(); await waitForAnimationFrame(); - expect(await getInputValue(page)).toBe("下午〇二:三〇:二五"); + expect(await getInputValue(page)).toBe("下午02:30"); }); describe("arabic locale support", () => { diff --git a/packages/calcite-components/src/components/input/input.stories.ts b/packages/calcite-components/src/components/input/input.stories.ts index f6508be46c0..74fe0fc1edc 100644 --- a/packages/calcite-components/src/components/input/input.stories.ts +++ b/packages/calcite-components/src/components/input/input.stories.ts @@ -155,9 +155,6 @@ export const darkModeRTL_TestOnly = (): string => html` `; darkModeRTL_TestOnly.parameters = { modes: modesDarkDefault }; -export const hebrewNumberingSystem_TestOnly = (): string => - html` `; - export const arabicLocaleWithLatinNumberingSystem_TestOnly = (): string => html` `; diff --git a/packages/calcite-components/src/components/stepper/stepper.e2e.ts b/packages/calcite-components/src/components/stepper/stepper.e2e.ts index b6b04fe40aa..c37cc28a9c1 100644 --- a/packages/calcite-components/src/components/stepper/stepper.e2e.ts +++ b/packages/calcite-components/src/components/stepper/stepper.e2e.ts @@ -651,13 +651,16 @@ describe("calcite-stepper", () => { const stepper1Number = await page.find("calcite-stepper-item[id='step-one'] >>> .stepper-item-number"); expect(stepper1Number.textContent).toBe("1."); - stepper2.setProperty("numberingSystem", "thai"); + stepper2.setProperty("numberingSystem", "arabext"); await page.waitForChanges(); + const stepper2Number = await page.find("calcite-stepper-item[id='step-two'] >>> .stepper-item-number"); - const thaiNumeral1 = new Intl.NumberFormat("th", { numberingSystem: "thai" } as NumberStringFormatOptions).format( - 1 - ); - expect(stepper2Number.textContent).toBe(`${thaiNumeral1}.`); + + const arabextNumeral1 = new Intl.NumberFormat("ar", { + numberingSystem: "arabext", + } as NumberStringFormatOptions).format(1); + + expect(stepper2Number.textContent).toBe(`${arabextNumeral1}.`); }); it("should have correct ARIA attributes", async () => { diff --git a/packages/calcite-components/src/components/text-area/text-area.stories.ts b/packages/calcite-components/src/components/text-area/text-area.stories.ts index cb0cdda014a..15366b003a9 100644 --- a/packages/calcite-components/src/components/text-area/text-area.stories.ts +++ b/packages/calcite-components/src/components/text-area/text-area.stories.ts @@ -71,14 +71,8 @@ export const exceedingMaxLength_TestOnly = (): string => html` `; -export const chineseLangNumberingSystem_TestOnly = (): string => html` - +export const chineseLang_TestOnly = (): string => html` + `; diff --git a/packages/calcite-components/src/demos/_assets/locales.ts b/packages/calcite-components/src/demos/_assets/locales.ts index 3954d09cf0c..934734189f9 100644 --- a/packages/calcite-components/src/demos/_assets/locales.ts +++ b/packages/calcite-components/src/demos/_assets/locales.ts @@ -208,7 +208,6 @@ export const locales: Locale[] = [ { name: "Thai (Thai digits)", locale: "th", - numberingSystem: "thai", }, { name: "Turkish", @@ -226,27 +225,12 @@ export const locales: Locale[] = [ name: "Chinese (China)", locale: "zh-CN", }, - { - name: "Chinese (China) (Hanidec numerals)", - locale: "zh-CN", - numberingSystem: "hanidec", - }, { name: "Chinese (Hong Kong)", locale: "zh-HK", }, - { - name: "Chinese (Hong Kong) (Hanidec numerals)", - locale: "zh-HK", - numberingSystem: "hanidec", - }, { name: "Chinese (Taiwan)", locale: "zh-TW", }, - { - name: "Chinese (Taiwan) (Hanidec numerals)", - locale: "zh-TW", - numberingSystem: "hanidec", - }, ]; diff --git a/packages/calcite-components/src/demos/date-picker.html b/packages/calcite-components/src/demos/date-picker.html index d83dc891301..b26feb0addd 100644 --- a/packages/calcite-components/src/demos/date-picker.html +++ b/packages/calcite-components/src/demos/date-picker.html @@ -218,33 +218,10 @@

Date-picker