Kaynağa Gözat

添加翻译

xy 7 yıl önce
ebeveyn
işleme
7c07d58df8

+ 44 - 29
src/app/graphqlService/component/schema/Create.js

@@ -1,6 +1,6 @@
 import React, {Component} from 'react';
-import { withRouter } from "react-router-dom";
-import {Modal,Row, Col, Input, Icon, Button, Spin} from 'antd';
+import {withRouter} from "react-router-dom";
+import {Modal, Row, Col, Input, Icon, Button, Spin} from 'antd';
 
 import {Mutation, Query} from "react-apollo";
 import gql from "graphql-tag";
@@ -9,6 +9,7 @@ import {SHOW_SCHEMA, ADD_SCHEMA} from '../../../../gql'
 import './index.css';
 import {getCookie} from "../../../../cookie";
 import {idGen} from "../../../../func";
+import {FormattedMessage} from 'react-intl';
 
 class Create extends Component {
     constructor(props) {
@@ -66,9 +67,9 @@ class Create extends Component {
         this.props.switchSidebar(schemaName);
         this.props.history.push({
             pathname: `/graphql-service/my-create/${schemaName}`,
-            state:{
+            state: {
                 schemaName,
-                schemaID:varobj.id,
+                schemaID: varobj.id,
                 create: true
             }
         });
@@ -91,31 +92,45 @@ class Create extends Component {
                         if (error)
                             return 'error';
                         return (
-                            <Modal title="Create Graphql Service"
-                                   centered
-                                   visible={visible}
-                                   onOk={() => this.handleOk(userID, create_schema)}
-                                   confirmLoading={confirmLoading}
-                                   onCancel={() => {this.props.hideModal();}}
-                            >
-                                <div>
-                                    <p>schema name</p>
-                                    <Input
-                                        className='add-input'
-                                        placeholder="input schema_name"
-                                        onChange={e => {
-                                            e.persist();
-                                            this.setState({
-                                                schemaName: e.target.value,
-                                            });
-                                            if(userID === '' || undefined) {
-                                                this.redirectToLogin();
-                                                this.props.hideModal();
-                                            }
-                                        }}
-                                    />
-                                </div>
-                            </Modal>
+                            <FormattedMessage id="Create Graphql Service">
+                                {(msg) => (
+                                    <Modal title={msg}
+                                           centered
+                                           visible={visible}
+                                           onOk={() => this.handleOk(userID, create_schema)}
+                                           confirmLoading={confirmLoading}
+                                           onCancel={() => {
+                                               this.props.hideModal();
+                                           }}
+                                    >
+                                        <div>
+                                            <p><FormattedMessage id="schema name"/></p>
+                                            <FormattedMessage id="input schema_name">
+                                                {(msg) => (
+                                                        <Input
+                                                            className='add-input'
+                                                            placeholder={msg}
+                                                            onChange={e => {
+                                                                e.persist();
+                                                                this.setState({
+                                                                    schemaName: e.target.value,
+                                                                });
+                                                                if (userID === '' || undefined) {
+                                                                    this.redirectToLogin();
+                                                                    this.props.hideModal();
+                                                                }
+                                                            }}
+                                                        />
+                                                    )
+                                                }
+
+                                            </FormattedMessage>
+
+                                        </div>
+                                    </Modal>
+                                )}
+                            </FormattedMessage>
+
                         )
                     }}
                 </Mutation>

+ 4 - 0
src/language/en_US.js

@@ -20,6 +20,10 @@ const en_US = {
     "login":"login",
     "Download":"Download",
 
+    "Create Graphql Service": 'Create Graphql Service',
+    "schema name": 'schema name',
+    "input schema_name": 'input schema_name',
+
     "Name":"Name",
     "name":"name",
     "type":"type",

+ 7 - 2
src/language/zh_CN.js

@@ -20,11 +20,15 @@ const zh_CN = {
     "login":"登陆",
     "Download":"下载",
 
+    "Create Graphql Service": '创建 Graphql服务',
+    "schema name": '表名',
+    "input schema_name": '请输入表名',
+
     "Name":"名称",
     "name":"名称",
     "type":"类型",
-    "description":"description",
-    "Remark":"描述",
+    "description":"描述",
+    "Remark":"备注",
     "copy":"复制",
     "Table":"表",
     "fields":"字段",
@@ -38,6 +42,7 @@ const zh_CN = {
     // deploy相关
     "Deploy":"部署",
 
+
     //account 个人中心相关
     "Account center":"账户中心",
     "Cloud settings":"云服务商配置",