Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(i18n)!: reduce list of supported numbering systems #8217

Merged
merged 6 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ export const flipPlacements_TestOnly = (): string => html`
</script>
`;

export const laoNumberingSystemAndMediumIconForLargeInput_TestOnly = (): string => html`
export const mediumIconForLargeInput_TestOnly = (): string => html`
<div style="width: 400px">
<calcite-input-date-picker
open
value="1/1/1"
lang="zh-CN"
numbering-system="laoo"
scale="l"
start="2020-12-12"
end="2020-12-16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,34 +115,20 @@ export const darkModeRTL_TestOnly = (): string => html`
`;
darkModeRTL_TestOnly.parameters = { modes: modesDarkDefault };

export const hebrewNumberingSystemAndMediumIconForLargeInputStyling_TestOnly = (): string =>
export const mediumIconForLargeInputStyling_TestOnly = (): string =>
html`
<calcite-input-number
number-button-type="vertical"
lang="ar-EG"
numbering-system="hebr"
value="123456"
scale="l"
></calcite-input-number
<calcite-input-number number-button-type="vertical" lang="ar-EG" value="123456" scale="l"></calcite-input-number
><calcite-input-number
number-button-type="vertical"
lang="ar-EG"
numbering-system="hebr"
value="123456"
scale="l"
icon="pen"
></calcite-input-number>
<calcite-input-number
number-button-type="horizontal"
lang="ar-EG"
numbering-system="hebr"
value="123456"
scale="l"
></calcite-input-number
<calcite-input-number number-button-type="horizontal" lang="ar-EG" value="123456" scale="l"></calcite-input-number
><calcite-input-number
number-button-type="horizontal"
lang="ar-EG"
numbering-system="hebr"
value="123456"
scale="l"
icon="pen"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,11 +665,10 @@ describe("calcite-input-time-picker", () => {
expect(await getInputValue(page)).toBe("٠٢:٣٠:٢٥ م");

inputTimePicker.setProperty("lang", "zh-HK");
inputTimePicker.setProperty("numberingSystem", "hanidec");
jcfranco marked this conversation as resolved.
Show resolved Hide resolved
await page.waitForChanges();
await waitForAnimationFrame();

expect(await getInputValue(page)).toBe("下午〇二:三〇:二五");
expect(await getInputValue(page)).toBe("下午02:30");
});

describe("arabic locale support", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ export const darkModeRTL_TestOnly = (): string => html`
`;
darkModeRTL_TestOnly.parameters = { modes: modesDarkDefault };

export const hebrewNumberingSystem_TestOnly = (): string =>
html` <calcite-input type="number" lang="ar-EG" numbering-system="hebr" value="123456"></calcite-input>`;

export const arabicLocaleWithLatinNumberingSystem_TestOnly = (): string =>
html` <calcite-input type="number" lang="ar-EG" value="123456"></calcite-input>`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,8 @@ export const exceedingMaxLength_TestOnly = (): string => html`
<calcite-text-area value="Rocky Mountains National Park" max-length="10"> </calcite-text-area>
`;

export const chineseLangNumberingSystem_TestOnly = (): string => html`
<calcite-text-area
value="Rocky Mountains National Park"
lang="zh-cn"
numbering-system="hanidec"
group-separator
max-length="654321"
>
export const chineseLang_TestOnly = (): string => html`
<calcite-text-area value="Rocky Mountains National Park" lang="zh-cn" group-separator max-length="654321">
</calcite-text-area>
`;

Expand Down
15 changes: 0 additions & 15 deletions packages/calcite-components/src/demos/_assets/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,27 +226,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",
},
];
25 changes: 1 addition & 24 deletions packages/calcite-components/src/demos/date-picker.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,30 +218,7 @@ <h1 style="margin: 0 auto; text-align: center">Date-picker</h1>
<script type="module">
import { locales } from "./_assets/locales.js";

const numberingSystems = [
"arab",
"arabext",
"bali",
"beng",
"deva",
"fullwide",
"gujr",
"guru",
"hanidec",
"khmr",
"knda",
"laoo",
"latn",
"limb",
"mlym",
"mong",
"mymr",
"orya",
"tamldec",
"telu",
"thai",
"tibt",
];
const numberingSystems = ["arab", "arabext", "latn", "thai"];

let selectedLang = "th";
let selectedNumberingSystem = "thai";
Expand Down
25 changes: 1 addition & 24 deletions packages/calcite-components/src/utils/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,7 @@ export const locales = [
"zh-TW",
];

export const numberingSystems = [
"arab",
"arabext",
"bali",
"beng",
"deva",
"fullwide",
"gujr",
"guru",
"hanidec",
"khmr",
"knda",
"laoo",
"latn",
"limb",
"mlym",
"mong",
"mymr",
"orya",
"tamldec",
"telu",
"thai",
"tibt",
] as const;
export const numberingSystems = ["arab", "arabext", "latn", "thai"] as const;

export const supportedLocales = [...new Set([...t9nLocales, ...locales])] as const;

Expand Down