yiminghe
9 years ago
12 changed files with 96 additions and 35 deletions
@ -0,0 +1,12 @@ |
|||
import objectAssign from 'object-assign'; |
|||
import GregorianCalendarLocale from 'gregorian-calendar/lib/locale/en_US'; |
|||
import CalendarLocale from 'rc-calendar/lib/locale/en_US'; |
|||
|
|||
// 统一合并为完整的 Locale
|
|||
let locale = objectAssign({}, GregorianCalendarLocale); |
|||
locale.lang = objectAssign({}, CalendarLocale); |
|||
|
|||
// All settings at:
|
|||
// https://github.com/ant-design/ant-design/issues/424
|
|||
|
|||
export default locale; |
@ -0,0 +1,20 @@ |
|||
# 国际化 |
|||
|
|||
- order: 6 |
|||
|
|||
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN |
|||
|
|||
--- |
|||
|
|||
````jsx |
|||
import { Pagination } from 'antd'; |
|||
import enUS from 'antd/lib/pagination/locale/en_US'; |
|||
|
|||
function onChange(page) { |
|||
console.log(page); |
|||
} |
|||
|
|||
ReactDOM.render( |
|||
<Pagination onChange={onChange} total={50} locale={enUS} />, |
|||
document.getElementById('components-pagination-demo-locale')); |
|||
```` |
@ -1,18 +1,31 @@ |
|||
import React from 'react'; |
|||
import Pagination from 'rc-pagination'; |
|||
import Select from 'rc-select'; |
|||
import zhCN from './locale/zh_CN'; |
|||
import enUS from './locale/en_US'; |
|||
|
|||
const prefixCls = 'ant-pagination'; |
|||
|
|||
export default class AntPagination extends React.Component { |
|||
class AntPagination extends React.Component { |
|||
render() { |
|||
let className = this.props.className; |
|||
if (this.props.size === 'small') { |
|||
className += ' mini'; |
|||
} |
|||
return <Pagination selectComponentClass={Select} |
|||
selectPrefixCls="ant-select" |
|||
prefixCls={prefixCls} |
|||
{...this.props} className={className} />; |
|||
selectPrefixCls="ant-select" |
|||
prefixCls={prefixCls} |
|||
{...this.props} className={className}/>; |
|||
} |
|||
} |
|||
|
|||
AntPagination.defaultProps = { |
|||
locale: zhCN, |
|||
}; |
|||
|
|||
AntPagination.locale = { |
|||
en_US: enUS, |
|||
zh_CN: zhCN, |
|||
}; |
|||
|
|||
export default AntPagination; |
|||
|
@ -0,0 +1 @@ |
|||
module.exports = require('rc-pagination/lib/locale/en_US'); |
@ -0,0 +1 @@ |
|||
module.exports = require('rc-pagination/lib/locale/zh_CN'); |
@ -0,0 +1 @@ |
|||
tnpm sync rc-dropdown rc-switch rc-calendar rc-input-number rc-menu rc-notification rc-form-validation rc-dialog rc-slider rc-tabs rc-progress rc-tooltip rc-select |
@ -0,0 +1,2 @@ |
|||
rm -rf node_modules/rc-* |
|||
tnpm install rc-collapse@latest rc-steps@latest rc-animate@latest rc-dialog@latest rc-queue-anim@latest rc-tree@latest rc-notification@latest rc-table@latest rc-upload@latest rc-pagination@latest rc-checkbox@latest rc-radio@latest rc-dropdown@latest rc-util@latest rc-switch@latest rc-calendar@latest rc-input-number@latest rc-menu@latest rc-notification@latest rc-form-validation@latest rc-dialog@latest rc-slider@latest rc-tabs@latest rc-progress@latest rc-tooltip@latest rc-select@latest --save |
Loading…
Reference in new issue