Commit ce856731 authored by nano's avatar nano

i18n

parent ad93297c
import { Button, Checkbox, Form, Icon, Input, Spin } from 'antd'; import { Button, Checkbox, Form, Icon, Input, Spin } from 'antd';
import { FormattedMessage as Format } from 'react-intl' import { FormattedMessage as Format } from 'react-intl'
import languages from '../../i18n.json'
import { connect } from 'dva'; import { connect } from 'dva';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
import React from 'react'; import React, { PropTypes } from 'react';
import "./Login.less" import "./Login.less"
const FormItem = Form.Item; const FormItem = Form.Item;
...@@ -11,6 +10,10 @@ const FormItem = Form.Item; ...@@ -11,6 +10,10 @@ const FormItem = Form.Item;
class Login extends React.Component { class Login extends React.Component {
static contextTypes = {
intl: PropTypes.object.isRequired,
}
onSubmitLogin = (e) => { onSubmitLogin = (e) => {
const { form, dispatch } = this.props; const { form, dispatch } = this.props;
if (e) { if (e) {
...@@ -28,8 +31,8 @@ class Login extends React.Component { ...@@ -28,8 +31,8 @@ class Login extends React.Component {
render() { render() {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { isLoginSubmit = false, language } = this.props; const { isLoginSubmit = false } = this.props;
const lan = languages[language] const { intl: {messages} } = this.context
return ( return (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100%' }}> <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100%' }}>
...@@ -39,7 +42,7 @@ class Login extends React.Component { ...@@ -39,7 +42,7 @@ class Login extends React.Component {
{getFieldDecorator('account', { {getFieldDecorator('account', {
rules: [{ required: true, message: 'Please input your account!' }], rules: [{ required: true, message: 'Please input your account!' }],
})( })(
<Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder={lan["Username"]} />, <Input prefix={<Icon type="user" style={{ fontSize: 13 }} />} placeholder={messages["Username"]} />,
)} )}
</FormItem> </FormItem>
<FormItem> <FormItem>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment