OSDN Git Service

add the translation for list header
authorZhiting Lin <zlin035@uottawa.ca>
Wed, 18 Apr 2018 13:24:44 +0000 (21:24 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Wed, 18 Apr 2018 13:24:44 +0000 (21:24 +0800)
src/features/accessControl/components/AccessControlList.jsx
src/features/accessControl/components/GrantListItem.jsx
src/features/accounts/components/List.jsx
src/features/assets/components/List.jsx
src/features/mockhsm/components/List.jsx

index ffb5696..c8608cf 100644 (file)
@@ -12,10 +12,10 @@ class AccessControlList extends React.Component {
       beginEditing: this.props.beginEditing,
       delete: this.props.delete,
     }
-    const tokenList = <TableList titles={['Token Name', 'Token']}>
-      {(this.props.tokens).map(item => <GrantListItem key={item.id} item={item} {...itemProps} />)}
-    </TableList>
     const lang = this.props.lang
+    const tokenList = <TableList titles={ lang==='zh'? ['令牌名称', '令牌']: ['Token Name', 'Token']}>
+      {(this.props.tokens).map(item => <GrantListItem key={item.id} item={item} lang={lang} {...itemProps} />)}
+    </TableList>
 
     // const certList = <TableList titles={['Certificate', 'Policies']}>
     //   {this.props.certs.map(item => <GrantListItem key={item.id} item={item} {...itemProps} />)}
index a03ff6f..f9a0e52 100644 (file)
@@ -8,6 +8,7 @@ import styles from './GrantListItem.scss'
 class GrantListItem extends React.Component {
   render() {
     const item = this.props.item
+    const lang = this.props.lang
 
     // let desc
     // if (isAccessToken(item)) {
@@ -41,7 +42,7 @@ class GrantListItem extends React.Component {
           {/*</button>*/}
 
           <button className='btn btn-link' onClick={this.props.delete.bind(this, item)}>
-            Delete
+            { lang==='zh'? '删除' : 'Delete' }
           </button>
         </td>}
         {/*{item.isEditing && <td colSpan='2'>*/}
index e89a8fb..7b83195 100644 (file)
@@ -1,14 +1,27 @@
 import { BaseList, TableList } from 'features/shared/components'
+
 import ListItem from './ListItem'
 
 const type = 'account'
 
+const mapStateToProps = (state) => {
+  let titles
+  if(state.core.lang === 'zh'){
+    titles = ['账户别名','账户ID']
+  }else{
+    titles = ['Account Alias', 'Account ID']
+  }
+
+  return {
+    ...BaseList.mapStateToProps(type, ListItem, {
+      wrapperComponent: TableList,
+      wrapperProps: {
+        titles: titles
+      }
+    })(state)
+  }
+}
 export default BaseList.connect(
-  BaseList.mapStateToProps(type, ListItem, {
-    wrapperComponent: TableList,
-    wrapperProps: {
-      titles: ['Account Alias', 'Account ID']
-    }
-  }),
+  mapStateToProps,
   BaseList.mapDispatchToProps(type)
 )
index bd09046..b111ea8 100644 (file)
@@ -4,12 +4,25 @@ import ListItem from './ListItem'
 
 const type = 'asset'
 
+const mapStateToProps = (state) => {
+  let titles
+  if(state.core.lang === 'zh'){
+    titles = ['资产别名','资产ID']
+  }else{
+    titles = ['Asset Alias', 'Asset ID']
+  }
+
+  return {
+    ...BaseList.mapStateToProps(type, ListItem, {
+      wrapperComponent: TableList,
+      wrapperProps: {
+        titles: titles
+      }
+    })(state)
+  }
+}
+
 export default BaseList.connect(
-  BaseList.mapStateToProps(type, ListItem, {
-    wrapperComponent: TableList,
-    wrapperProps: {
-      titles: ['Asset Alias', 'Asset ID']
-    }
-  }),
+  mapStateToProps,
   BaseList.mapDispatchToProps(type)
 )
index 799b47f..1fdede1 100644 (file)
@@ -29,15 +29,28 @@ class KeyList extends BaseList.ItemList {
   }
 }
 
+const mapStateToProps = (state) => {
+  let titles
+  if(state.core.lang === 'zh'){
+    titles = ['别名','扩展公钥']
+  }else{
+    titles = ['Alias', 'xpub']
+  }
+
+  return {
+    ...BaseList.mapStateToProps(type, ListItem, {
+      skipQuery: true,
+      label: 'Keys',
+      wrapperComponent: TableList,
+      wrapperProps: {
+        titles: titles
+      }
+    })(state)
+  }
+}
+
 export default BaseList.connect(
-  BaseList.mapStateToProps(type, ListItem, {
-    skipQuery: true,
-    label: 'Keys',
-    wrapperComponent: TableList,
-    wrapperProps: {
-      titles: ['Alias', 'xpub']
-    }
-  }),
+  mapStateToProps,
   BaseList.mapDispatchToProps(type),
   KeyList
 )