Skip to content

Commit

Permalink
refactor: remove support for chinese locale
Browse files Browse the repository at this point in the history
  • Loading branch information
emmenko committed Nov 20, 2024
1 parent ca99231 commit 970fb17
Show file tree
Hide file tree
Showing 8 changed files with 9 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]: '年',
},
};
310 changes: 0 additions & 310 deletions packages/i18n/data/zh-CN.json

This file was deleted.

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 970fb17

Please sign in to comment.