Skip to content

Commit

Permalink
fix(DatePicker): locale
Browse files Browse the repository at this point in the history
  • Loading branch information
bushuai committed Jan 25, 2021
1 parent daaa46f commit d223f3c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions source/components/DatePicker/panel/DatePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
nextMonth,
timeFormat,
dateFormat,
MONTH_ARRRY,
YEARS_ARRAY,
isValidValue,
setTime
Expand Down Expand Up @@ -330,7 +329,7 @@ class DatePanel extends React.Component {
<YearAndMonthPopover
key="month"
value={currentDate.getMonth() + 1}
sourceData={MONTH_ARRRY[lang]}
sourceData={Locales.MONTH_ARRAY}
onChange={(month) => this.handleChangeMonth(month, Locales)}
>
<span
Expand All @@ -354,7 +353,8 @@ class DatePanel extends React.Component {
</span>
</YearAndMonthPopover>);

const selectors = lang === 'zh_CN' ? [ yearSelector, monthSelector ] : [ monthSelector, yearSelector ];
// TODO: 配置此处展示方式
const selectors = lang === 'en_US' ? [ monthSelector, yearSelector ] : [ yearSelector, monthSelector ] ;

return (<div
className={classNames(
Expand Down
5 changes: 2 additions & 3 deletions source/components/DatePicker/panel/DateRangePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
dateFormat,
formatDate,
parseDate,
MONTH_ARRRY,
YEARS_ARRAY,
isValidValue,
isValidValueArr,
Expand Down Expand Up @@ -740,7 +739,7 @@ class DateRangePanel extends React.Component {
</YearAndMonthPopover>
<YearAndMonthPopover
value={leftDate.getMonth() + 1}
sourceData={MONTH_ARRRY[lang]}
sourceData={Locales.MONTH_ARRAY}
onChange={() => this.handleChangeMonth.bind(this, 'leftDate', leftDate, Locales)}
>
<span className={`${prefixCls}-date-range-picker__header-label`}>
Expand Down Expand Up @@ -790,7 +789,7 @@ class DateRangePanel extends React.Component {
</YearAndMonthPopover>
<YearAndMonthPopover
value={rightDate.getMonth() + 1}
sourceData={MONTH_ARRRY[lang]}
sourceData={Locales.MONTH_ARRAY}
onChange={() => this.handleChangeMonth.bind(this, 'rightDate', rightDate, Locales)}
>
<span className={`${prefixCls}-date-range-picker__header-label`}>
Expand Down
3 changes: 2 additions & 1 deletion source/components/Locale/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const LocaleValue: LocaleProperties = {
Oct: '10',
Nov: '11',
Dec: '12',
MONTH_ARRAY: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
week: 'Week',
weeks: {
sun: 'Sun',
Expand Down Expand Up @@ -131,7 +132,7 @@ const LocaleValue: LocaleProperties = {
next_3: 'Next 3 Pages'
},
RichEditor: {
// editor
// editor
insertImageTip: 'JPG, JPEG, PNG, GIF, BMP format images, best display height no more than 400px, width no more than 270px.',
rule1: '1、Single video does not exceed 10M, supports MP4, 3GP format video',
rule2: '2、The best display height is no more than 400px',
Expand Down
3 changes: 2 additions & 1 deletion source/components/Locale/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const localeValues: LocaleProperties = {
next_3: '向后 3 页',
},
RichEditor: {
// editor
// editor
insertImageTip: '支持jpg、jpeg、png、gif、bmp格式的图片,最佳显示高度不超过400px,宽度不超过270px。',
rule1: '1、单个视频不超过10M,支持MP4、3GP格式视频。',
rule2: '2、最佳显示高度不超过400px',
Expand Down Expand Up @@ -200,6 +200,7 @@ const localeValues: LocaleProperties = {
'10月': '10',
'11月': '11',
'12月': '12',
MONTH_ARRAY: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
week: '周次',
weeks: {
sun: '日',
Expand Down
3 changes: 2 additions & 1 deletion source/components/Locale/zh_TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const localeValues: LocaleProperties = {
next_3: '向後 3 頁',
},
RichEditor: {
// editor
// editor
insertImageTip: '支持jpg、jpeg、png、gif、bmp格式的圖片,最佳顯示高度不超過400px,寬度不超過270px。',
rule1: '1、單個視頻不超過10M,支持MP4、3GP格式視頻。',
rule2: '2、最佳顯示高度不超過400px',
Expand Down Expand Up @@ -200,6 +200,7 @@ const localeValues: LocaleProperties = {
'10月': '10',
'11月': '11',
'12月': '12',
MONTH_ARRAY: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
week: '週次',
weeks: {
sun: '日',
Expand Down
6 changes: 0 additions & 6 deletions source/utils/date/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ export const dateFormat = (format) => {
else return 'yyyy-MM-dd';
};

// 月份数组
export const MONTH_ARRRY = {
zh_CN: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
en_US: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
};

// 年份数组
export const YEARS_ARRAY = (N=50) => {
const result = [];
Expand Down

0 comments on commit d223f3c

Please sign in to comment.