OSDN Git Service

add translation to page title.
authorZhiting Lin <zlin035@uottawa.ca>
Fri, 2 Mar 2018 05:18:16 +0000 (13:18 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Fri, 2 Mar 2018 05:18:16 +0000 (13:18 +0800)
src/features/accounts/routes.js
src/features/assets/routes.js
src/features/mockhsm/routes.js
src/features/shared/components/PageTitle/PageTitle.jsx
src/features/shared/routes.js
src/features/transactions/routes.js

index 6574a3c..93d8444 100644 (file)
@@ -1,4 +1,4 @@
 import { List, New, AccountShow, AccountUpdate } from './components'
 import { makeRoutes } from 'features/shared'
 
-export default (store) => makeRoutes(store, 'account', List, New, AccountShow, AccountUpdate)
+export default (store) => makeRoutes(store, 'account', List, New, AccountShow, AccountUpdate, {name_zh: '账户'})
index 05c2419..b5a21f3 100644 (file)
@@ -1,4 +1,4 @@
 import { List, New, AssetShow, AssetUpdate } from './components'
 import { makeRoutes } from 'features/shared'
 
-export default (store) => makeRoutes(store, 'asset', List, New, AssetShow, AssetUpdate)
+export default (store) => makeRoutes(store, 'asset', List, New, AssetShow, AssetUpdate, {name_zh: '资产'})
index 89c5190..3130373 100644 (file)
@@ -1,4 +1,4 @@
 import { List, New } from './components'
 import { makeRoutes } from 'features/shared'
 
-export default (store) => makeRoutes(store, 'key', List, New, null, null, { skipFilter: true, name: 'Keys' })
+export default (store) => makeRoutes(store, 'key', List, New, null, null, { skipFilter: true, name: 'Keys', name_zh:'密钥' })
index c14b739..3200470 100644 (file)
@@ -52,6 +52,7 @@ const mapStateToProps = (state) => {
   const routes = makeRoutes()
   const pathname = state.routing.locationBeforeTransitions.pathname
   const breadcrumbs = []
+  const lang = state.core.lang
 
   let currentRoutes = routes.childRoutes
   let currentPath = []
@@ -65,8 +66,12 @@ const mapStateToProps = (state) => {
       currentPath.push(component)
 
       if (!match.skipBreadcrumb) {
+        let crumbName =  match.name || humanize(component)
+        if( lang === 'zh' &&  match.name_zh ){
+          crumbName = match.name_zh
+        }
         breadcrumbs.push({
-          name: match.name || humanize(component),
+          name: crumbName ,
           path: currentPath.join('/')
         })
       }
index fddb88b..1c8f29f 100644 (file)
@@ -38,6 +38,7 @@ const makeRoutes = (store, type, List, New, Show, Update, options = {}) => {
     path: options.path || type + 's',
     component: RoutingContainer,
     name: options.name || humanize(type + 's'),
+    name_zh: options.name_zh,
     indexRoute: {
       component: List,
       onEnter: (nextState, replace) => {
index b0a07c0..663fe8b 100644 (file)
@@ -15,7 +15,8 @@ export default (store) => {
           path: 'generated/:id',
           component: GeneratedTxHex,
         },
-      ]
+      ],
+      name_zh: '交易'
     }
   )
 }