Browse Source

docs: translate message

pull/2274/merge
Benjy Cui 9 years ago
parent
commit
0869e2959a
  1. 9
      components/icon/index.jsx
  2. 14
      components/message/demo/duration.md
  3. 14
      components/message/demo/info.md
  4. 16
      components/message/demo/loading.md
  5. 22
      components/message/demo/other.md
  6. 46
      components/message/index.en-US.md
  7. 0
      components/message/index.zh-CN.md

9
components/icon/index.jsx

@ -1,9 +0,0 @@
"use strict";
const react_1 = require('react');
const splitObject_1 = require('../_util/splitObject');
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = props => {
const [{ type, className = '' }, others] = splitObject_1.default(props, ['type', 'className']);
let className2 = `${className} anticon anticon-${type}`.trim();
return <i className={className2} {...others}/>;
};

14
components/message/demo/duration.md

@ -1,17 +1,25 @@
---
order: 2
title: 修改延时
title:
zh-CN: 修改延时
en-US: Customize duration
---
## zh-CN
自定义时长 `10s`,默认时长为 `1.5s`
## en-US
Customize message display duration from default `1.5s` to `10s`.
````jsx
import { message, Button } from 'antd';
const success = function () {
message.success('这是一条成功的提示,并将于10秒后消失', 10);
message.success('This is a prompt message for success, and it will disappear in 10 seconds', 10);
};
ReactDOM.render(<Button onClick={success}>自定义时长提示</Button>
ReactDOM.render(<Button onClick={success}>Customized display duration</Button>
, mountNode);
````

14
components/message/demo/info.md

@ -1,17 +1,25 @@
---
order: 0
title: 普通提示
title:
zh-CN: 普通提示
en-US: Normal prompt
---
## zh-CN
信息提醒反馈。
## en-US
Normal messages as feedbacks.
````jsx
import { message, Button } from 'antd';
const info = function () {
message.info('这是一条普通的提醒');
message.info('This is a normal message');
};
ReactDOM.render(<Button type="primary" onClick={info}>显示普通提醒</Button>
ReactDOM.render(<Button type="primary" onClick={info}>Display normal message</Button>
, mountNode);
````

16
components/message/demo/loading.md

@ -1,19 +1,27 @@
---
order: 3
title: 加载中
title:
zh-CN: 加载中
en-US: Message of loading
---
## zh-CN
进行全局 loading,异步自行移除。
## en-US
Display a global loading indicator, which is dismissed by itself asynchronously.
````jsx
import { message, Button } from 'antd';
const success = function () {
let hide = message.loading('正在执行中...', 0);
// 异步手动移除
let hide = message.loading('Action in progress..', 0);
// Dismiss manually and asynchronously
setTimeout(hide, 2500);
};
ReactDOM.render(<Button onClick={success}>显示加载中...</Button>
ReactDOM.render(<Button onClick={success}>Display a loading indicator</Button>
, mountNode);
````

22
components/message/demo/other.md

@ -1,29 +1,37 @@
---
order: 1
title: 其他提示类型
title:
zh-CN: 其他提示类型
en-US: Other types of message
---
## zh-CN
包括成功、失败、警告。
## en-US
Messages of success, error and warning types.
````jsx
import { message, Button } from 'antd';
const success = function () {
message.success('这是一条成功提示');
message.success('This is a message of success');
};
const error = function () {
message.error('这是一条报错提示');
message.error('This is a message of error');
};
const warning = function () {
message.warning('这是一条警告提示');
message.warning('This is message of warning');
};
ReactDOM.render(<div>
<Button onClick={success}>显示成功提示</Button>
<Button onClick={error}>显示报错提示</Button>
<Button onClick={warning}>显示警告提示</Button>
<Button onClick={success}>Success</Button>
<Button onClick={error}>Error</Button>
<Button onClick={warning}>Warning</Button>
</div>, mountNode);
````

46
components/message/index.en-US.md

@ -0,0 +1,46 @@
---
category: Components
type: Presentation
noinstant: true
english: Message
---
Display global messages as feedbacks to user operations.
## When To Use
- To provide feedbacks such as success, warning, error etc.
- A message is displayed at top and center and will be dismissed automatically, as a non-interrupting light-weighted prompt.
## API
- `message.success(content, duration)`
- `message.error(content, duration)`
- `message.info(content, duration)`
- `message.warning(content, duration)`
- `message.warn(content, duration)`
- `message.loading(content, duration)`
This components provides 4 static methods, with arguments as following:
| Argument | Description | Type | Default |
|------------|------------------------------------|--------------------------|--------------|
| content | content of the message | React.Element or String | - |
| duration | time before auto-dismiss,in seconds | number | 1.5 |
Methods for global configuration and destruction are also provided:
- `message.config(options)`
- `message.destroy()`
```js
message.config({
top: 100,
duration: 2,
});
```
| Argument | Description | Type | Default |
|------------|------------------------------------|--------------------------|-------------|
| top | distance to top | Number | 24px |
| duration | time before auto-dismiss,in seconds | Number | 1.5 |

0
components/message/index.md → components/message/index.zh-CN.md

Loading…
Cancel
Save