Skip to content

Commit

Permalink
feat: remove support for locale zh-CN (#2988)
Browse files Browse the repository at this point in the history
* refactor: remove support for chinese locale

* refactor: keep zh-CN.json file for backwards compat

---------

Co-authored-by: Nicola Molinari <[email protected]>
  • Loading branch information
mustafaasif2 and emmenko authored Dec 5, 2024
1 parent 0d1056b commit 5853bcd
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 330 deletions.
7 changes: 7 additions & 0 deletions .changeset/blue-shirts-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@commercetools-uikit/calendar-time-utils': minor
'@commercetools-uikit/i18n': minor
'@commercetools-local/storybook': minor
---

Remove support for chinese locale
3 changes: 0 additions & 3 deletions packages/calendar-time-utils/src/calendar-time.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('getLocalizedDateTimeFormatPattern', () => {
es: 'DD/MM/AAAA',
'fr-FR': 'JJ/MM/AAAA',
'pt-BR': 'DD/MM/AAAA',
'zh-CN': '年/月/日',
xx: 'MM/DD/YYYY', // unknown locale returns the default pattern moment provides
};

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

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

Expand Down
8 changes: 0 additions & 8 deletions packages/calendar-time-utils/src/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,4 @@ export const DATE_FORMAT_LOCALIZED_MAPPINGS: TLocalizedDateFormatMapping = {
// DD/MM/YYYY - HH:mm -> DD/MM/AAAA - HH:mm
[formatToken.YYYY]: 'AAAA',
},
'zh-CN': {
// YYYY/MM/DD - HH:mm -> 年/月/日 - 小时:分钟
[formatToken.HH]: '小时',
[formatToken.mm]: '分钟',
[formatToken.DD]: '日',
[formatToken.MM]: '月',
[formatToken.YYYY]: '年',
},
};
311 changes: 1 addition & 310 deletions packages/i18n/data/zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,310 +1 @@
{
"UIKit.CalendarHeader.nextMonthTooltip": {
"developer_comment": "Tooltip title when user hovers the next month button",
"string": "下个月"
},
"UIKit.CalendarHeader.nextYearTooltip": {
"developer_comment": "Tooltip title when user hovers the next year button",
"string": "下一年"
},
"UIKit.CalendarHeader.previousMonthTooltip": {
"developer_comment": "Tooltip title when user hovers the previous month button",
"string": "上个月"
},
"UIKit.CalendarHeader.previousYearTooltip": {
"developer_comment": "Tooltip title when user hovers the previous year button",
"string": "上一年"
},
"UIKit.CalendarHeader.todayTooltip": {
"developer_comment": "Tooltip title when user hovers the today button",
"string": "今天"
},
"UIKit.ClearAllButton.clearAllButtonLabel": {
"developer_comment": "Label for the clear all button",
"string": "全部清除"
},
"UIKit.ClearButton.clearButtonLabel": {
"developer_comment": "Label for the clear button",
"string": "清除"
},
"UIKit.CreatableSelectInput.createLabel": {
"developer_comment": "Text of dropdown when creating option",
"string": "创建 \"{inputValue}\""
},
"UIKit.DataTableManager.ColumnManager.DroppablePanel.loadMoreAttributesHint": {
"developer_comment": "Indicate that the user can use the search input to load more attributes",
"string": "使用上面的搜索输入加载更多属性"
},
"UIKit.DataTableManager.ColumnManager.closeButtonLabel": {
"developer_comment": "Label for density manager close button.",
"string": "关闭"
},
"UIKit.DataTableManager.ColumnManager.hiddenColumns": {
"developer_comment": "Message for the hidden columns section",
"string": "隐藏列"
},
"UIKit.DataTableManager.ColumnManager.noHiddenColumnsToShow": {
"developer_comment": "Label when there are no hidden columns to show",
"string": "没有要显示的隐藏列。"
},
"UIKit.DataTableManager.ColumnManager.noSelectedColumnsToShow": {
"developer_comment": "Label when there are no selected columns to show",
"string": "没有要显示的已选列。"
},
"UIKit.DataTableManager.ColumnManager.title": {
"developer_comment": "Title for the column manager component.",
"string": "列管理器"
},
"UIKit.DataTableManager.ColumnSelectorGroups.visible": {
"developer_comment": "Message for the visible columns section.",
"string": "可见列"
},
"UIKit.DataTableManager.CustomSettingsManager.closeButtonLabel": {
"developer_comment": "Label for custom settings manager close button.",
"string": "关闭"
},
"UIKit.DataTableManager.DensityManager.closeButtonLabel": {
"developer_comment": "Label for density manager close button.",
"string": "关闭"
},
"UIKit.DataTableManager.DensityManager.densityDisplayComfortableOption": {
"developer_comment": "Density display default option.",
"string": "舒适"
},
"UIKit.DataTableManager.DensityManager.densityDisplayCompactOption": {
"developer_comment": "Density display compact option.",
"string": "紧凑型"
},
"UIKit.DataTableManager.DensityManager.densityDisplaySubtitle": {
"developer_comment": "Subtitle for the density display options.",
"string": "行密度"
},
"UIKit.DataTableManager.DensityManager.textWrappingAllWrapVisibleOption": {
"developer_comment": "All wrapped texts visible option.",
"string": "显示全文。"
},
"UIKit.DataTableManager.DensityManager.textWrappingShowHideOnDemandOption": {
"developer_comment": "Show or hide texts on demand option.",
"string": "显示文本预览并按需进行扩展。"
},
"UIKit.DataTableManager.DensityManager.textWrappingSubtitle": {
"developer_comment": "Subtitle for the text wrapping options.",
"string": "文字可见度"
},
"UIKit.DataTableManager.DensityManager.title": {
"developer_comment": "Title for the density manager component.",
"string": "表格布局设置"
},
"UIKit.DataTableManager.TableSettings.columnManagerOption": {
"developer_comment": "Column manager dropdown option label.",
"string": "列管理器"
},
"UIKit.DataTableManager.TableSettings.displaySettingsOption": {
"developer_comment": "Display settings dropdown option label.",
"string": "布局设置"
},
"UIKit.DataTableManager.TableSettings.placeholder": {
"developer_comment": "Placeholder for the table settings select component.",
"string": "表格设置"
},
"UIKit.FieldErrors.invalidFractionalNumber": {
"developer_comment": "Error message when fractional number is used",
"string": "需要完整数字。"
},
"UIKit.FieldErrors.invalidNegativeNumber": {
"developer_comment": "Error message when negative number is used",
"string": "不支持负数。"
},
"UIKit.FieldErrors.missingRequiredField": {
"developer_comment": "Error message for missing required value",
"string": "此字段为必填项。请提供一个值。"
},
"UIKit.LocalizedMoneyInput.hide": {
"developer_comment": "Hide currencies button",
"string": "隐藏货币 ({remainingCurrencies})"
},
"UIKit.LocalizedMoneyInput.missingRequiredField": {
"developer_comment": "Error message for missing required value",
"string": "此字段为必填项。请提供至少一个值。"
},
"UIKit.LocalizedMoneyInput.show": {
"developer_comment": "Show all currencies button",
"string": "显示所有货币 ({remainingCurrencies})"
},
"UIKit.LocalizedTextInput.hide": {
"developer_comment": "Label of language collapse button",
"string": "隐藏语言 ({remainingLanguages})"
},
"UIKit.LocalizedTextInput.missingRequiredField": {
"developer_comment": "Error message for missing required value",
"string": "此字段为必填项。请提供至少一个值。"
},
"UIKit.LocalizedTextInput.show": {
"developer_comment": "Label of language expansion button",
"string": "显示所有语言 ({remainingLanguages})"
},
"UIKit.MoneyInput.highPrecision": {
"developer_comment": "Label of high precision tooltip in MoneyInput",
"string": "价格精确度高"
},
"UIKit.MultilineTextInput.collapse": {
"developer_comment": "The label for \"collapse\" action",
"string": "崩溃"
},
"UIKit.MultilineTextInput.expand": {
"developer_comment": "The label for \"expand\" action",
"string": "扩展"
},
"UIKit.NumberField.aboveMaxError": {
"developer_comment": "An error message to show when the value is above the maximum",
"string": "值必须小于或等于 {max}。"
},
"UIKit.NumberField.belowMinError": {
"developer_comment": "An error message to show when the value is below the minimum",
"string": "值必须大于或等于 {min}。"
},
"UIKit.Pagination.PageNavigator.nextPageLabel": {
"developer_comment": "Label for next page button",
"string": "下一页"
},
"UIKit.Pagination.PageNavigator.page": {
"developer_comment": "Label for page",
"string": "页面"
},
"UIKit.Pagination.PageNavigator.pageCount": {
"developer_comment": "Label for total pages",
"string": "{count} 的"
},
"UIKit.Pagination.PageNavigator.previousPageLabel": {
"developer_comment": "Label for previous page button",
"string": "上一页"
},
"UIKit.Pagination.PageSizeSelector.pageSize": {
"developer_comment": "How many items are per page",
"string": "每页项目数({count} 项目)"
},
"UIKit.PasswordField.hide": {
"developer_comment": "Label for the button to hide the password",
"string": "隐藏"
},
"UIKit.PasswordField.show": {
"developer_comment": "Label for the button to show the password",
"string": "显示"
},
"UIKit.RichTextBody.boldButtonLabel": {
"developer_comment": "Label for the bold button",
"string": "粗体"
},
"UIKit.RichTextBody.expandButtonLabel": {
"developer_comment": "Label for the expand button",
"string": "扩展"
},
"UIKit.RichTextBody.italicButtonLabel": {
"developer_comment": "Label for the italic button",
"string": "斜体"
},
"UIKit.RichTextBody.moreStylesDropdownLabel": {
"developer_comment": "Label for the more styles dropdown",
"string": "更多样式"
},
"UIKit.RichTextBody.moreStylesDropdownOptionStrikethrough": {
"developer_comment": "label for the more styles `strikethrough` option",
"string": "删除线"
},
"UIKit.RichTextBody.moreStylesDropdownOptionSubscript": {
"developer_comment": "label for the more styles `subscript` option",
"string": "下标"
},
"UIKit.RichTextBody.moreStylesDropdownOptionSuperscript": {
"developer_comment": "label for the more styles `superscript` option",
"string": "上标"
},
"UIKit.RichTextBody.orderedListButtonLabel": {
"developer_comment": "Label for the numbered list button",
"string": "编号列表"
},
"UIKit.RichTextBody.redoButtonLabel": {
"developer_comment": "Label for the redo button",
"string": "重做"
},
"UIKit.RichTextBody.styleDropdownLabel": {
"developer_comment": "Label for the style dropdown",
"string": "样式"
},
"UIKit.RichTextBody.styleDropdownOptionH1": {
"developer_comment": "Label for the `headline-one` option",
"string": "标题 H1"
},
"UIKit.RichTextBody.styleDropdownOptionH2": {
"developer_comment": "Label for the `headline-two` option",
"string": "标题 H2"
},
"UIKit.RichTextBody.styleDropdownOptionH3": {
"developer_comment": "Label for the `headline-three` option",
"string": "标题 H3"
},
"UIKit.RichTextBody.styleDropdownOptionH4": {
"developer_comment": "Label for the `headline-four` option",
"string": "标题 H4"
},
"UIKit.RichTextBody.styleDropdownOptionH5": {
"developer_comment": "Label for the `headline-five` option",
"string": "标题 H5"
},
"UIKit.RichTextBody.styleDropdownOptionParagraph": {
"developer_comment": "Label for the `paragraph` option",
"string": "段落"
},
"UIKit.RichTextBody.styleDropdownOptionPreformatted": {
"developer_comment": "Label for the `code` option",
"string": "预格式化"
},
"UIKit.RichTextBody.styleDropdownOptionQuote": {
"developer_comment": "Label for the `quote` option",
"string": "引用"
},
"UIKit.RichTextBody.underlinedButtonLabel": {
"developer_comment": "Label for the underline button",
"string": "下划线"
},
"UIKit.RichTextBody.undoButtonLabel": {
"developer_comment": "Label for the undo button",
"string": "撤销"
},
"UIKit.RichTextBody.unorderedListButtonLabel": {
"developer_comment": "Label for the bullet list button",
"string": "项目符号列表"
},
"UIKit.SearchSelectInput.loadingOptionsMessage": {
"developer_comment": "Text showed while the options are being loaded",
"string": "正在加载完全匹配项"
},
"UIKit.SearchSelectInput.noOptionsMessage": {
"developer_comment": "Text of search select dropdown when no options match search text",
"string": "找不到与您的搜索字词匹配的内容"
},
"UIKit.SearchSelectInput.placeholderMessage": {
"developer_comment": "Placeholder text for the input",
"string": "搜索方式…"
},
"UIKit.SelectInput.loadingOptions": {
"developer_comment": "Default input loading text",
"string": "正在加载..."
},
"UIKit.SelectInput.noOptionsMessageWithInputValue": {
"developer_comment": "Text of dropdown when no options match search text",
"string": "无选项"
},
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": {
"developer_comment": "Text of dropdown when no options exist",
"string": "无选项"
},
"UIKit.SelectInput.placeholder": {
"developer_comment": "Default input placeholder text",
"string": "选择..."
},
"UIKit.TimeInput.placeholder": {
"developer_comment": "Placeholder for time input",
"string": "小时:分钟"
}
}
{}
4 changes: 1 addition & 3 deletions storybook/src/decorators/intl-decorator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, { useEffect, useState } from 'react';
import { IntlProvider } from 'react-intl';
import { default as en } from '../../../packages/i18n/data/en.json';

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

interface TranslationItem {
developer_comment: string;
Expand Down Expand Up @@ -42,8 +42,6 @@ const getMessagesForLocale = (
return import('../../../packages/i18n/data/de.json');
case 'fr-FR':
return import('../../../packages/i18n/data/fr-FR.json');
case 'zh-CN':
return import('../../../packages/i18n/data/zh-CN.json');
default:
throw new Error(`Unable to load messages for locale ${locale}.`);
}
Expand Down
4 changes: 1 addition & 3 deletions storybook/src/global-types/intl-global.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const locales = ['en', 'en-GB', 'de', 'es', 'fr-FR', 'zh-CN'];
export const locales = ['en', 'en-GB', 'de', 'es', 'fr-FR'];

const namifyLocale = (locale: string) => {
switch (locale) {
Expand All @@ -12,8 +12,6 @@ const namifyLocale = (locale: string) => {
return 'Deutsch';
case 'fr-FR':
return 'Français';
case 'zh-CN':
return '简化字';
default:
return locale;
}
Expand Down
2 changes: 0 additions & 2 deletions test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ const getMessagesForLocale = (locale) => {
return require('@commercetools-uikit/i18n/compiled-data/fr-FR.json');
case 'pt-BR':
return require('@commercetools-uikit/i18n/compiled-data/pt-BR.json');
case 'zh-CN':
return require('@commercetools-uikit/i18n/compiled-data/zh-CN.json');
default:
return require('@commercetools-uikit/i18n/compiled-data/en.json');
}
Expand Down
Loading

0 comments on commit 5853bcd

Please sign in to comment.