OSDN Git Service

add the translation to all required field.
authorZhiting Lin <zlin035@uottawa.ca>
Wed, 18 Apr 2018 08:44:48 +0000 (16:44 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Wed, 18 Apr 2018 08:44:48 +0000 (16:44 +0800)
src/features/accounts/components/New.jsx
src/features/app/components/Modal/Modal.jsx
src/features/assets/components/New.jsx
src/features/shared/components/BaseList/EmptyList.jsx
src/features/shared/components/KeyConfiguration.jsx
src/features/shared/components/ObjectSelectorField/ObjectSelectorField.jsx
src/features/shared/components/SelectField.jsx
src/features/shared/components/XpubField/XpubField.jsx
src/features/transactions/components/New/FormActionItem.jsx
src/features/transactions/components/New/New.jsx

index 3ff2e89..9279cce 100644 (file)
@@ -35,7 +35,7 @@ class Form extends React.Component {
       >
 
         <FormSection title={ lang === 'zh' ? '账户信息' : 'Account Information' }>
-          <TextField title='Alias' placeholder='Alias' fieldProps={alias} autoFocus={true} />
+          <TextField title={ lang === 'zh' ? '别名':'Alias'} placeholder={ lang === 'zh' ? '别名':'Alias'} fieldProps={alias} autoFocus={true} />
         </FormSection>
 
         <FormSection title={ lang === 'zh' ? '密钥和签名' : 'Keys and Signing' }>
index c6b4f72..4edf046 100644 (file)
@@ -30,7 +30,7 @@ class Modal extends React.Component {
           {body}
 
           <button className={`btn btn-${this.props.options.danger ? 'danger' : 'primary'} ${styles.accept}`} onClick={accept}>
-            { lang === 'zh' ?  '确定' : 'OK' }</button>
+            { lang === 'zh' ?  '关闭' : 'OK' }</button>
           {cancel && <button className={`btn btn-link ${styles.cancel}`} onClick={cancel}>Cancel</button>}
         </div>
       </div>
index dc19c71..5a70821 100644 (file)
@@ -34,15 +34,16 @@ class Form extends React.Component {
         lang={lang}>
 
         <FormSection title={ lang === 'zh' ? '资产信息' : 'Asset Information'}>
-          <TextField title='Alias' placeholder='Alias' fieldProps={alias} autoFocus={true} />
+          <TextField title={ lang === 'zh' ? '别名' : 'Alias'} placeholder={ lang === 'zh' ? '别名' : 'Alias'} fieldProps={alias} autoFocus={true} />
           <JsonField title={ lang === 'zh' ? '定义' : 'Definition' } fieldProps={definition} lang={lang}/>
         </FormSection>
 
         <FormSection title={ lang === 'zh' ? '密钥和签名' :'Keys and Signing' }>
           <KeyConfiguration
+            lang={lang}
             xpubs={xpubs}
             quorum={quorum}
-            quorumHint='Number of signatures required to issue' />
+            quorumHint={ lang === 'zh' ? '所需的签名数' : 'Number of signatures required to issue' } />
         </FormSection>
 
       </FormContainer>
index d640b79..61fde98 100644 (file)
@@ -5,6 +5,7 @@ import { docsRoot } from 'utility/environment'
 
 class EmptyList extends React.Component {
   render() {
+    const lang =this.props.lang
     let emptyImage
 
     try {
index 5516332..5fea835 100644 (file)
@@ -50,11 +50,12 @@ class KeyConfiguration extends React.Component {
     }
 
     const quorumOptions = rangeOptions.slice(0, this.state.keys)
+    const lang = this.props.lang
 
     return(
       <div>
         <SelectField options={rangeOptions}
-          title='Keys'
+          title={ lang === 'zh' ? '密钥数' : 'Keys' }
           skipEmpty={true}
           fieldProps={{
             value: this.state.keys,
@@ -62,7 +63,7 @@ class KeyConfiguration extends React.Component {
           }} />
 
         <SelectField options={quorumOptions}
-          title='Quorum'
+          title={ lang === 'zh' ? '签名数' : 'Quorum' }
           skipEmpty={true}
           hint={quorumHint}
           fieldProps={{
@@ -76,7 +77,7 @@ class KeyConfiguration extends React.Component {
             index={index}
             typeProps={xpub.type}
             valueProps={xpub.value}
-            lang={this.props.lang}
+            lang={lang}
           />)}
       </div>
     )
index 424a9d1..50fa680 100644 (file)
@@ -44,6 +44,9 @@ class ObjectSelectorField extends React.Component {
       this.props.fieldProps.id.onChange('')
     }
 
+    const lang = this.props.lang
+    const alias_title = ( lang === 'zh' ? '别名' : ALIAS_SELECTED )
+
     const idProps = Object.assign({...this.props.fieldProps.id}, {onChange: idOnChange})
     const aliasProps = Object.assign({...this.props.fieldProps.alias}, {onChange: aliasOnChange})
 
@@ -55,10 +58,10 @@ class ObjectSelectorField extends React.Component {
             <DropdownButton
               className={styles.dropdownButton}
               id='input-dropdown-addon'
-              title={this.state.selected}
+              title={(this.state.selected === ALIAS_SELECTED)? alias_title: this.state.selected}
               onSelect={this.select}
             >
-              <MenuItem eventKey={ALIAS_SELECTED}>Alias</MenuItem>
+              <MenuItem eventKey={ALIAS_SELECTED}>{ lang === 'zh' ? '别名' : 'Alias'}</MenuItem>
               <MenuItem eventKey={ID_SELECTED}>ID</MenuItem>
             </DropdownButton>
           </div>
@@ -72,7 +75,7 @@ class ObjectSelectorField extends React.Component {
           {this.state.selected == ALIAS_SELECTED &&
             <this.props.aliasField
               className={styles.aliasFieldGroupItem}
-              placeholder={`Start typing ${this.props.title.toLowerCase()} alias...`}
+              placeholder={ lang === 'zh' ? `输入${this.props.title.toLowerCase()}别名.` : `Start typing ${this.props.title.toLowerCase()} alias...`}
               fieldProps={aliasProps} />}
 
         </div>
index 47569ed..292f796 100644 (file)
@@ -12,8 +12,9 @@ const SELECT_FIELD_PROPS = [
 
 class SelectField extends React.Component {
   render() {
+    const lang = this.props.lang
     const options = this.props.options
-    const emptyLabel = this.props.emptyLabel || 'Select one...'
+    const emptyLabel = this.props.emptyLabel || ((lang === 'zh') ? '请选择...' : 'Select one...')
     const valueKey = this.props.valueKey || 'value'
     const labelKey = this.props.labelKey || 'label'
 
index 0a21591..000f59b 100644 (file)
@@ -62,6 +62,7 @@ class XpubField extends React.Component {
         autoFocus={this.state.autofocusInput}
         valueKey='xpub'
         labelKey='label'
+        lang={lang}
         fieldProps={{...valueProps, onChange: valueOnChange}} />,
       'provide': <TextField
         autoFocus={this.state.autofocusInput}
@@ -75,7 +76,7 @@ class XpubField extends React.Component {
 
     return (
       <div className={styles.main}>
-        <FieldLabel>Key {this.props.index + 1}</FieldLabel>
+        <FieldLabel>{ lang === 'zh' ? '密钥' :'Key '}{this.props.index + 1}</FieldLabel>
 
         <table className={styles.options}>
           <tbody>
index 234f854..ed648d5 100644 (file)
@@ -70,6 +70,7 @@ export default class ActionItem extends React.Component {
       this.props.remove(this.props.index)
     }
 
+    const lang = this.props.lang
     const btmAmounUnitVisible = (assetAlias.value === 'BTM' ||
       assetId.value === 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' )
 
@@ -82,14 +83,15 @@ export default class ActionItem extends React.Component {
 
         <div className={styles.header}>
           <label className={styles.title}>{actionLabels[type.value]}</label>
-          <a href='#' className='btn btn-sm btn-danger' onClick={remove}>Remove</a>
+          <a href='#' className='btn btn-sm btn-danger' onClick={remove}>{ lang === 'zh' ? '删除' : 'Remove' }</a>
         </div>
 
         {type.error && <ErrorBanner message={type.error} />}
 
         {visible.account &&
           <ObjectSelectorField
-            title='Account'
+            lang={lang}
+            title={ lang === 'zh' ? '账户' : 'Account' }
             aliasField={Autocomplete.AccountAlias}
             fieldProps={{
               id: accountId,
@@ -107,7 +109,8 @@ export default class ActionItem extends React.Component {
 
         {visible.asset &&
           <ObjectSelectorField
-            title='Asset'
+            title={ lang === 'zh' ? '资产' :'Asset'}
+            lang={lang}
             aliasField={Autocomplete.AssetAlias}
             fieldProps={{
               id: assetId,
@@ -116,13 +119,13 @@ export default class ActionItem extends React.Component {
           />}
 
         {visible.amount && !btmAmounUnitVisible &&
-          <TextField title='Amount' fieldProps={amount} />}
+          <TextField title={ lang === 'zh' ? '数量' :'Amount' } fieldProps={amount} />}
 
         {visible.amount && btmAmounUnitVisible &&
-          <AmountUnitField title='Amount' fieldProps={amount} />}
+          <AmountUnitField title={ lang === 'zh' ? '数量' :'Amount' } fieldProps={amount} />}
 
         {visible.password && false &&
-          <TextField title='Password' placeholder='Password' fieldProps={password} autoFocus={false} type={'password'} />
+          <TextField title={lang === 'zh' ? '密码' :'Password'} placeholder={lang === 'zh' ? '密码' :'Password'} fieldProps={password} autoFocus={false} type={'password'} />
         }
 
         {false && this.state.referenceDataOpen &&
index 873d376..e57889a 100644 (file)
@@ -198,6 +198,8 @@ class Form extends React.Component {
           <label className={styles.title}>{ lang === 'zh' ? '从' : 'From' }</label>
           <div className={styles.main}>
             <ObjectSelectorField
+              key='account-selector-field'
+              lang={lang}
               title={ lang === 'zh' ? '账户' :'Account' }
               aliasField={Autocomplete.AccountAlias}
               fieldProps={{
@@ -206,6 +208,8 @@ class Form extends React.Component {
               }}
             />
             <ObjectSelectorField
+              key='asset-selector-field'
+              lang={lang}
               title={ lang === 'zh' ? '资产' : 'Asset' }
               aliasField={Autocomplete.AssetAlias}
               fieldProps={{
@@ -271,6 +275,7 @@ class Form extends React.Component {
               accounts={this.props.accounts}
               assets={this.props.assets}
               remove={this.removeActionItem}
+              lang={lang}
             />)}
 
           <div className={`btn-group ${styles.addActionContainer} ${this.state.showDropdown && 'open'}`}>
@@ -282,7 +287,6 @@ class Form extends React.Component {
             >
               <MenuItem eventKey='issue'>Issue</MenuItem>
               <MenuItem eventKey='spend_account'>Spend from account</MenuItem>
-              <MenuItem eventKey='control_receiver'>Control with receiver</MenuItem>
               <MenuItem eventKey='control_address'>Control with address</MenuItem>
               <MenuItem eventKey='retire'>Retire</MenuItem>
             </DropdownButton>