Skip to content

Commit 5853bcd

Browse files
feat: remove support for locale zh-CN (#2988)
* refactor: remove support for chinese locale * refactor: keep zh-CN.json file for backwards compat --------- Co-authored-by: Nicola Molinari <[email protected]>
1 parent 0d1056b commit 5853bcd

File tree

8 files changed

+10
-330
lines changed

8 files changed

+10
-330
lines changed

.changeset/blue-shirts-live.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@commercetools-uikit/calendar-time-utils': minor
3+
'@commercetools-uikit/i18n': minor
4+
'@commercetools-local/storybook': minor
5+
---
6+
7+
Remove support for chinese locale

packages/calendar-time-utils/src/calendar-time.spec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ describe('getLocalizedDateTimeFormatPattern', () => {
1818
es: 'DD/MM/AAAA',
1919
'fr-FR': 'JJ/MM/AAAA',
2020
'pt-BR': 'DD/MM/AAAA',
21-
'zh-CN': '年/月/日',
2221
xx: 'MM/DD/YYYY', // unknown locale returns the default pattern moment provides
2322
};
2423

@@ -30,7 +29,6 @@ describe('getLocalizedDateTimeFormatPattern', () => {
3029
es: 'HH:mm',
3130
'fr-FR': 'HH:mm',
3231
'pt-BR': 'HH:mm',
33-
'zh-CN': '小时:分钟',
3432
xx: 'h:mm A', // unknown locale returns the default pattern moment provides
3533
};
3634

@@ -42,7 +40,6 @@ describe('getLocalizedDateTimeFormatPattern', () => {
4240
es: 'DD/MM/AAAA - HH:mm',
4341
'fr-FR': 'JJ/MM/AAAA - HH:mm',
4442
'pt-BR': 'DD/MM/AAAA - HH:mm',
45-
'zh-CN': '年/月/日 - 小时:分钟',
4643
xx: 'MM/DD/YYYY - h:mm A', // unknown locale returns the default pattern moment provides
4744
};
4845

packages/calendar-time-utils/src/formats.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,4 @@ export const DATE_FORMAT_LOCALIZED_MAPPINGS: TLocalizedDateFormatMapping = {
5454
// DD/MM/YYYY - HH:mm -> DD/MM/AAAA - HH:mm
5555
[formatToken.YYYY]: 'AAAA',
5656
},
57-
'zh-CN': {
58-
// YYYY/MM/DD - HH:mm -> 年/月/日 - 小时:分钟
59-
[formatToken.HH]: '小时',
60-
[formatToken.mm]: '分钟',
61-
[formatToken.DD]: '日',
62-
[formatToken.MM]: '月',
63-
[formatToken.YYYY]: '年',
64-
},
6557
};

packages/i18n/data/zh-CN.json

Lines changed: 1 addition & 310 deletions
Original file line numberDiff line numberDiff line change
@@ -1,310 +1 @@
1-
{
2-
"UIKit.CalendarHeader.nextMonthTooltip": {
3-
"developer_comment": "Tooltip title when user hovers the next month button",
4-
"string": "下个月"
5-
},
6-
"UIKit.CalendarHeader.nextYearTooltip": {
7-
"developer_comment": "Tooltip title when user hovers the next year button",
8-
"string": "下一年"
9-
},
10-
"UIKit.CalendarHeader.previousMonthTooltip": {
11-
"developer_comment": "Tooltip title when user hovers the previous month button",
12-
"string": "上个月"
13-
},
14-
"UIKit.CalendarHeader.previousYearTooltip": {
15-
"developer_comment": "Tooltip title when user hovers the previous year button",
16-
"string": "上一年"
17-
},
18-
"UIKit.CalendarHeader.todayTooltip": {
19-
"developer_comment": "Tooltip title when user hovers the today button",
20-
"string": "今天"
21-
},
22-
"UIKit.ClearAllButton.clearAllButtonLabel": {
23-
"developer_comment": "Label for the clear all button",
24-
"string": "全部清除"
25-
},
26-
"UIKit.ClearButton.clearButtonLabel": {
27-
"developer_comment": "Label for the clear button",
28-
"string": "清除"
29-
},
30-
"UIKit.CreatableSelectInput.createLabel": {
31-
"developer_comment": "Text of dropdown when creating option",
32-
"string": "创建 \"{inputValue}\""
33-
},
34-
"UIKit.DataTableManager.ColumnManager.DroppablePanel.loadMoreAttributesHint": {
35-
"developer_comment": "Indicate that the user can use the search input to load more attributes",
36-
"string": "使用上面的搜索输入加载更多属性"
37-
},
38-
"UIKit.DataTableManager.ColumnManager.closeButtonLabel": {
39-
"developer_comment": "Label for density manager close button.",
40-
"string": "关闭"
41-
},
42-
"UIKit.DataTableManager.ColumnManager.hiddenColumns": {
43-
"developer_comment": "Message for the hidden columns section",
44-
"string": "隐藏列"
45-
},
46-
"UIKit.DataTableManager.ColumnManager.noHiddenColumnsToShow": {
47-
"developer_comment": "Label when there are no hidden columns to show",
48-
"string": "没有要显示的隐藏列。"
49-
},
50-
"UIKit.DataTableManager.ColumnManager.noSelectedColumnsToShow": {
51-
"developer_comment": "Label when there are no selected columns to show",
52-
"string": "没有要显示的已选列。"
53-
},
54-
"UIKit.DataTableManager.ColumnManager.title": {
55-
"developer_comment": "Title for the column manager component.",
56-
"string": "列管理器"
57-
},
58-
"UIKit.DataTableManager.ColumnSelectorGroups.visible": {
59-
"developer_comment": "Message for the visible columns section.",
60-
"string": "可见列"
61-
},
62-
"UIKit.DataTableManager.CustomSettingsManager.closeButtonLabel": {
63-
"developer_comment": "Label for custom settings manager close button.",
64-
"string": "关闭"
65-
},
66-
"UIKit.DataTableManager.DensityManager.closeButtonLabel": {
67-
"developer_comment": "Label for density manager close button.",
68-
"string": "关闭"
69-
},
70-
"UIKit.DataTableManager.DensityManager.densityDisplayComfortableOption": {
71-
"developer_comment": "Density display default option.",
72-
"string": "舒适"
73-
},
74-
"UIKit.DataTableManager.DensityManager.densityDisplayCompactOption": {
75-
"developer_comment": "Density display compact option.",
76-
"string": "紧凑型"
77-
},
78-
"UIKit.DataTableManager.DensityManager.densityDisplaySubtitle": {
79-
"developer_comment": "Subtitle for the density display options.",
80-
"string": "行密度"
81-
},
82-
"UIKit.DataTableManager.DensityManager.textWrappingAllWrapVisibleOption": {
83-
"developer_comment": "All wrapped texts visible option.",
84-
"string": "显示全文。"
85-
},
86-
"UIKit.DataTableManager.DensityManager.textWrappingShowHideOnDemandOption": {
87-
"developer_comment": "Show or hide texts on demand option.",
88-
"string": "显示文本预览并按需进行扩展。"
89-
},
90-
"UIKit.DataTableManager.DensityManager.textWrappingSubtitle": {
91-
"developer_comment": "Subtitle for the text wrapping options.",
92-
"string": "文字可见度"
93-
},
94-
"UIKit.DataTableManager.DensityManager.title": {
95-
"developer_comment": "Title for the density manager component.",
96-
"string": "表格布局设置"
97-
},
98-
"UIKit.DataTableManager.TableSettings.columnManagerOption": {
99-
"developer_comment": "Column manager dropdown option label.",
100-
"string": "列管理器"
101-
},
102-
"UIKit.DataTableManager.TableSettings.displaySettingsOption": {
103-
"developer_comment": "Display settings dropdown option label.",
104-
"string": "布局设置"
105-
},
106-
"UIKit.DataTableManager.TableSettings.placeholder": {
107-
"developer_comment": "Placeholder for the table settings select component.",
108-
"string": "表格设置"
109-
},
110-
"UIKit.FieldErrors.invalidFractionalNumber": {
111-
"developer_comment": "Error message when fractional number is used",
112-
"string": "需要完整数字。"
113-
},
114-
"UIKit.FieldErrors.invalidNegativeNumber": {
115-
"developer_comment": "Error message when negative number is used",
116-
"string": "不支持负数。"
117-
},
118-
"UIKit.FieldErrors.missingRequiredField": {
119-
"developer_comment": "Error message for missing required value",
120-
"string": "此字段为必填项。请提供一个值。"
121-
},
122-
"UIKit.LocalizedMoneyInput.hide": {
123-
"developer_comment": "Hide currencies button",
124-
"string": "隐藏货币 ({remainingCurrencies})"
125-
},
126-
"UIKit.LocalizedMoneyInput.missingRequiredField": {
127-
"developer_comment": "Error message for missing required value",
128-
"string": "此字段为必填项。请提供至少一个值。"
129-
},
130-
"UIKit.LocalizedMoneyInput.show": {
131-
"developer_comment": "Show all currencies button",
132-
"string": "显示所有货币 ({remainingCurrencies})"
133-
},
134-
"UIKit.LocalizedTextInput.hide": {
135-
"developer_comment": "Label of language collapse button",
136-
"string": "隐藏语言 ({remainingLanguages})"
137-
},
138-
"UIKit.LocalizedTextInput.missingRequiredField": {
139-
"developer_comment": "Error message for missing required value",
140-
"string": "此字段为必填项。请提供至少一个值。"
141-
},
142-
"UIKit.LocalizedTextInput.show": {
143-
"developer_comment": "Label of language expansion button",
144-
"string": "显示所有语言 ({remainingLanguages})"
145-
},
146-
"UIKit.MoneyInput.highPrecision": {
147-
"developer_comment": "Label of high precision tooltip in MoneyInput",
148-
"string": "价格精确度高"
149-
},
150-
"UIKit.MultilineTextInput.collapse": {
151-
"developer_comment": "The label for \"collapse\" action",
152-
"string": "崩溃"
153-
},
154-
"UIKit.MultilineTextInput.expand": {
155-
"developer_comment": "The label for \"expand\" action",
156-
"string": "扩展"
157-
},
158-
"UIKit.NumberField.aboveMaxError": {
159-
"developer_comment": "An error message to show when the value is above the maximum",
160-
"string": "值必须小于或等于 {max}。"
161-
},
162-
"UIKit.NumberField.belowMinError": {
163-
"developer_comment": "An error message to show when the value is below the minimum",
164-
"string": "值必须大于或等于 {min}。"
165-
},
166-
"UIKit.Pagination.PageNavigator.nextPageLabel": {
167-
"developer_comment": "Label for next page button",
168-
"string": "下一页"
169-
},
170-
"UIKit.Pagination.PageNavigator.page": {
171-
"developer_comment": "Label for page",
172-
"string": "页面"
173-
},
174-
"UIKit.Pagination.PageNavigator.pageCount": {
175-
"developer_comment": "Label for total pages",
176-
"string": "{count} 的"
177-
},
178-
"UIKit.Pagination.PageNavigator.previousPageLabel": {
179-
"developer_comment": "Label for previous page button",
180-
"string": "上一页"
181-
},
182-
"UIKit.Pagination.PageSizeSelector.pageSize": {
183-
"developer_comment": "How many items are per page",
184-
"string": "每页项目数({count} 项目)"
185-
},
186-
"UIKit.PasswordField.hide": {
187-
"developer_comment": "Label for the button to hide the password",
188-
"string": "隐藏"
189-
},
190-
"UIKit.PasswordField.show": {
191-
"developer_comment": "Label for the button to show the password",
192-
"string": "显示"
193-
},
194-
"UIKit.RichTextBody.boldButtonLabel": {
195-
"developer_comment": "Label for the bold button",
196-
"string": "粗体"
197-
},
198-
"UIKit.RichTextBody.expandButtonLabel": {
199-
"developer_comment": "Label for the expand button",
200-
"string": "扩展"
201-
},
202-
"UIKit.RichTextBody.italicButtonLabel": {
203-
"developer_comment": "Label for the italic button",
204-
"string": "斜体"
205-
},
206-
"UIKit.RichTextBody.moreStylesDropdownLabel": {
207-
"developer_comment": "Label for the more styles dropdown",
208-
"string": "更多样式"
209-
},
210-
"UIKit.RichTextBody.moreStylesDropdownOptionStrikethrough": {
211-
"developer_comment": "label for the more styles `strikethrough` option",
212-
"string": "删除线"
213-
},
214-
"UIKit.RichTextBody.moreStylesDropdownOptionSubscript": {
215-
"developer_comment": "label for the more styles `subscript` option",
216-
"string": "下标"
217-
},
218-
"UIKit.RichTextBody.moreStylesDropdownOptionSuperscript": {
219-
"developer_comment": "label for the more styles `superscript` option",
220-
"string": "上标"
221-
},
222-
"UIKit.RichTextBody.orderedListButtonLabel": {
223-
"developer_comment": "Label for the numbered list button",
224-
"string": "编号列表"
225-
},
226-
"UIKit.RichTextBody.redoButtonLabel": {
227-
"developer_comment": "Label for the redo button",
228-
"string": "重做"
229-
},
230-
"UIKit.RichTextBody.styleDropdownLabel": {
231-
"developer_comment": "Label for the style dropdown",
232-
"string": "样式"
233-
},
234-
"UIKit.RichTextBody.styleDropdownOptionH1": {
235-
"developer_comment": "Label for the `headline-one` option",
236-
"string": "标题 H1"
237-
},
238-
"UIKit.RichTextBody.styleDropdownOptionH2": {
239-
"developer_comment": "Label for the `headline-two` option",
240-
"string": "标题 H2"
241-
},
242-
"UIKit.RichTextBody.styleDropdownOptionH3": {
243-
"developer_comment": "Label for the `headline-three` option",
244-
"string": "标题 H3"
245-
},
246-
"UIKit.RichTextBody.styleDropdownOptionH4": {
247-
"developer_comment": "Label for the `headline-four` option",
248-
"string": "标题 H4"
249-
},
250-
"UIKit.RichTextBody.styleDropdownOptionH5": {
251-
"developer_comment": "Label for the `headline-five` option",
252-
"string": "标题 H5"
253-
},
254-
"UIKit.RichTextBody.styleDropdownOptionParagraph": {
255-
"developer_comment": "Label for the `paragraph` option",
256-
"string": "段落"
257-
},
258-
"UIKit.RichTextBody.styleDropdownOptionPreformatted": {
259-
"developer_comment": "Label for the `code` option",
260-
"string": "预格式化"
261-
},
262-
"UIKit.RichTextBody.styleDropdownOptionQuote": {
263-
"developer_comment": "Label for the `quote` option",
264-
"string": "引用"
265-
},
266-
"UIKit.RichTextBody.underlinedButtonLabel": {
267-
"developer_comment": "Label for the underline button",
268-
"string": "下划线"
269-
},
270-
"UIKit.RichTextBody.undoButtonLabel": {
271-
"developer_comment": "Label for the undo button",
272-
"string": "撤销"
273-
},
274-
"UIKit.RichTextBody.unorderedListButtonLabel": {
275-
"developer_comment": "Label for the bullet list button",
276-
"string": "项目符号列表"
277-
},
278-
"UIKit.SearchSelectInput.loadingOptionsMessage": {
279-
"developer_comment": "Text showed while the options are being loaded",
280-
"string": "正在加载完全匹配项"
281-
},
282-
"UIKit.SearchSelectInput.noOptionsMessage": {
283-
"developer_comment": "Text of search select dropdown when no options match search text",
284-
"string": "找不到与您的搜索字词匹配的内容"
285-
},
286-
"UIKit.SearchSelectInput.placeholderMessage": {
287-
"developer_comment": "Placeholder text for the input",
288-
"string": "搜索方式…"
289-
},
290-
"UIKit.SelectInput.loadingOptions": {
291-
"developer_comment": "Default input loading text",
292-
"string": "正在加载..."
293-
},
294-
"UIKit.SelectInput.noOptionsMessageWithInputValue": {
295-
"developer_comment": "Text of dropdown when no options match search text",
296-
"string": "无选项"
297-
},
298-
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": {
299-
"developer_comment": "Text of dropdown when no options exist",
300-
"string": "无选项"
301-
},
302-
"UIKit.SelectInput.placeholder": {
303-
"developer_comment": "Default input placeholder text",
304-
"string": "选择..."
305-
},
306-
"UIKit.TimeInput.placeholder": {
307-
"developer_comment": "Placeholder for time input",
308-
"string": "小时:分钟"
309-
}
310-
}
1+
{}

storybook/src/decorators/intl-decorator.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { useEffect, useState } from 'react';
44
import { IntlProvider } from 'react-intl';
55
import { default as en } from '../../../packages/i18n/data/en.json';
66

7-
export const locales = ['en', 'en-GB', 'de', 'es', 'fr-FR', 'zh-CN'];
7+
export const locales = ['en', 'en-GB', 'de', 'es', 'fr-FR'];
88

99
interface TranslationItem {
1010
developer_comment: string;
@@ -42,8 +42,6 @@ const getMessagesForLocale = (
4242
return import('../../../packages/i18n/data/de.json');
4343
case 'fr-FR':
4444
return import('../../../packages/i18n/data/fr-FR.json');
45-
case 'zh-CN':
46-
return import('../../../packages/i18n/data/zh-CN.json');
4745
default:
4846
throw new Error(`Unable to load messages for locale ${locale}.`);
4947
}

storybook/src/global-types/intl-global.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const locales = ['en', 'en-GB', 'de', 'es', 'fr-FR', 'zh-CN'];
1+
export const locales = ['en', 'en-GB', 'de', 'es', 'fr-FR'];
22

33
const namifyLocale = (locale: string) => {
44
switch (locale) {
@@ -12,8 +12,6 @@ const namifyLocale = (locale: string) => {
1212
return 'Deutsch';
1313
case 'fr-FR':
1414
return 'Français';
15-
case 'zh-CN':
16-
return '简化字';
1715
default:
1816
return locale;
1917
}

test/test-utils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ const getMessagesForLocale = (locale) => {
1515
return require('@commercetools-uikit/i18n/compiled-data/fr-FR.json');
1616
case 'pt-BR':
1717
return require('@commercetools-uikit/i18n/compiled-data/pt-BR.json');
18-
case 'zh-CN':
19-
return require('@commercetools-uikit/i18n/compiled-data/zh-CN.json');
2018
default:
2119
return require('@commercetools-uikit/i18n/compiled-data/en.json');
2220
}

0 commit comments

Comments
 (0)