Skip to content

Commit

Permalink
Remove japanese locale (#2248)
Browse files Browse the repository at this point in the history
* feat: remove japanese locale support

* fix: fix extract-intl script command

* fix(calendar-time): fix tests

* chore: changeset added
  • Loading branch information
CarlosCortizasCT authored Aug 4, 2022
1 parent 7cdfce4 commit cf14801
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 101 deletions.
6 changes: 6 additions & 0 deletions .changeset/grumpy-worms-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@commercetools-uikit/calendar-time-utils': patch
'@commercetools-uikit/i18n': patch
---

remove japanese locale support
6 changes: 1 addition & 5 deletions docs/.storybook/configs/intl-context.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { IntlProvider } from 'react-intl';

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

const getMessagesForLocale = (locale) => {
switch (locale) {
Expand All @@ -17,8 +17,6 @@ const getMessagesForLocale = (locale) => {
return require('../../../packages/i18n/data/fr-FR.json');
case 'zh-CN':
return require('../../../packages/i18n/data/zh-CN.json');
case 'ja':
return require('../../../packages/i18n/data/ja.json');
default:
throw new Error(`Unable to load messages for locale ${locale}.`);
}
Expand All @@ -38,8 +36,6 @@ const namifyLocale = (locale) => {
return 'Français';
case 'zh-CN':
return '简化字';
case 'ja':
return '日本人';
default:
return locale;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const sourceFolders = [
module.exports = ({ config }) => {
config.plugins.push(
new MomentLocalesPlugin({
localesToKeep: ['de', 'es', 'fr', 'zh-cn', 'ja', 'en-gb'],
localesToKeep: ['de', 'es', 'fr', 'zh-cn', 'en-gb'],
})
);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build": "./scripts/build.sh",
"build:watch": "./scripts/build_watch.sh",
"start": "yarn --cwd docs start",
"extract-intl": "formatjs extract --format=./packages/i18n/transifex-transformer.js --out-file=./packages/i18n/data/core.json '{packages,src/components}/**/messages.js'",
"extract-intl": "formatjs extract --format=./packages/i18n/transifex-transformer.js --out-file=./packages/i18n/data/core.json '{packages,src/components}/**/messages.ts'",
"compile-intl": "yarn workspace @commercetools-uikit/i18n compile-data",
"lint": "jest --projects jest.eslint.config.js",
"lint:js": "jest --config jest.eslint.config.js",
Expand Down
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 @@ -8,7 +8,6 @@ describe('getLocalizedDateTimeFormatPattern', () => {
'en-AU': 'DD/MM/YYYY',
es: 'DD/MM/AAAA',
'fr-FR': 'JJ/MM/AAAA',
ja: '年/月/日',
'zh-CN': '年/月/日',
xx: 'MM/DD/YYYY', // unknown locale returns the default pattern moment provides
};
Expand All @@ -20,7 +19,6 @@ describe('getLocalizedDateTimeFormatPattern', () => {
'en-AU': 'HH:mm AM/PM',
es: 'HH:mm',
'fr-FR': 'HH:mm',
ja: '午前/午後 時:分',
'zh-CN': '小时:分钟',
xx: 'h:mm A', // unknown locale returns the default pattern moment provides
};
Expand All @@ -32,7 +30,6 @@ describe('getLocalizedDateTimeFormatPattern', () => {
'en-AU': 'DD/MM/YYYY - HH:mm AM/PM',
es: 'DD/MM/AAAA - HH:mm',
'fr-FR': 'JJ/MM/AAAA - HH:mm',
ja: '年/月/日 - 午前/午後 時:分',
'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 @@ -50,14 +50,6 @@ export const DATE_FORMAT_LOCALIZED_MAPPINGS: TLocalizedDateFormatMapping = {
[formatToken.DD]: 'JJ',
[formatToken.YYYY]: 'AAAA',
},
ja: {
// YYYY/MM/DD - HH:mm -> 年/月/日 - 午前/午後 時:分
[formatToken.HH]: '午前/午後 時',
[formatToken.mm]: '分',
[formatToken.DD]: '日',
[formatToken.MM]: '月',
[formatToken.YYYY]: '年',
},
'zh-CN': {
// YYYY/MM/DD - HH:mm -> 年/月/日 - 小时:分钟
[formatToken.HH]: '小时',
Expand Down
4 changes: 0 additions & 4 deletions packages/i18n/data/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
"UIKit.DataTableManager.TableSettings.columnManagerOption": "Column manager",
"UIKit.DataTableManager.TableSettings.displaySettingsOption": "Display settings",
"UIKit.DataTableManager.TableSettings.placeholder": "Table settings",
"UIKit.DateInput.placeholder": "MM/DD/YYYY",
"UIKit.DateRangeInput.placeholder": "MM/DD/YYYY - MM/DD/YYYY",
"UIKit.DateTimeInput.placeholder": "MM/DD/YYYY - HH:mm AM/PM",
"UIKit.DateTimeInput.timePlaceholder": "HH:mm AM/PM",
"UIKit.FieldErrors.invalidFractionalNumber": "A whole number is required.",
"UIKit.FieldErrors.invalidNegativeNumber": "Negative number is not supported.",
"UIKit.FieldErrors.missingRequiredField": "This field is required. Provide a value.",
Expand Down
79 changes: 0 additions & 79 deletions packages/i18n/data/ja.json

This file was deleted.

1 comment on commit cf14801

@vercel
Copy link

@vercel vercel bot commented on cf14801 Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.