Skip to content

Commit 051188f

Browse files
committed
fix(i18n): Account Settings page lang support
1 parent be88bcd commit 051188f

File tree

7 files changed

+72
-67
lines changed

7 files changed

+72
-67
lines changed

src/config/router.config.js

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import { bxAnaalyse } from '@/core/icons'
44

55
const RouteView = {
66
name: 'RouteView',
7-
render: (h) => h('router-view')
7+
render: h => h('router-view')
88
}
99

1010
export const asyncRouterMap = [
11-
1211
{
1312
path: '/',
1413
name: 'index',
@@ -22,13 +21,13 @@ export const asyncRouterMap = [
2221
name: 'dashboard',
2322
redirect: '/dashboard/workplace',
2423
component: RouteView,
25-
meta: { title: 'menu.dashboard', keepAlive: true, icon: bxAnaalyse, permission: [ 'dashboard' ] },
24+
meta: { title: 'menu.dashboard', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
2625
children: [
2726
{
2827
path: '/dashboard/analysis/:pageNo([1-9]\\d*)?',
2928
name: 'Analysis',
3029
component: () => import('@/views/dashboard/Analysis'),
31-
meta: { title: 'menu.dashboard.analysis', keepAlive: false, permission: [ 'dashboard' ] }
30+
meta: { title: 'menu.dashboard.analysis', keepAlive: false, permission: ['dashboard'] }
3231
},
3332
// 外部链接
3433
{
@@ -40,7 +39,7 @@ export const asyncRouterMap = [
4039
path: '/dashboard/workplace',
4140
name: 'Workplace',
4241
component: () => import('@/views/dashboard/Workplace'),
43-
meta: { title: 'menu.dashboard.workplace', keepAlive: true, permission: [ 'dashboard' ] }
42+
meta: { title: 'menu.dashboard.workplace', keepAlive: true, permission: ['dashboard'] }
4443
}
4544
]
4645
},
@@ -49,25 +48,25 @@ export const asyncRouterMap = [
4948
path: '/form',
5049
redirect: '/form/base-form',
5150
component: RouteView,
52-
meta: { title: 'menu.form', icon: 'form', permission: [ 'form' ] },
51+
meta: { title: 'menu.form', icon: 'form', permission: ['form'] },
5352
children: [
5453
{
5554
path: '/form/base-form',
5655
name: 'BaseForm',
5756
component: () => import('@/views/form/basicForm'),
58-
meta: { title: 'menu.form.basic-form', keepAlive: true, permission: [ 'form' ] }
57+
meta: { title: 'menu.form.basic-form', keepAlive: true, permission: ['form'] }
5958
},
6059
{
6160
path: '/form/step-form',
6261
name: 'StepForm',
6362
component: () => import('@/views/form/stepForm/StepForm'),
64-
meta: { title: 'menu.form.step-form', keepAlive: true, permission: [ 'form' ] }
63+
meta: { title: 'menu.form.step-form', keepAlive: true, permission: ['form'] }
6564
},
6665
{
6766
path: '/form/advanced-form',
6867
name: 'AdvanceForm',
6968
component: () => import('@/views/form/advancedForm/AdvancedForm'),
70-
meta: { title: 'menu.form.advanced-form', keepAlive: true, permission: [ 'form' ] }
69+
meta: { title: 'menu.form.advanced-form', keepAlive: true, permission: ['form'] }
7170
}
7271
]
7372
},
@@ -77,51 +76,51 @@ export const asyncRouterMap = [
7776
name: 'list',
7877
component: RouteView,
7978
redirect: '/list/table-list',
80-
meta: { title: 'menu.list', icon: 'table', permission: [ 'table' ] },
79+
meta: { title: 'menu.list', icon: 'table', permission: ['table'] },
8180
children: [
8281
{
8382
path: '/list/table-list/:pageNo([1-9]\\d*)?',
8483
name: 'TableListWrapper',
8584
hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
8685
component: () => import('@/views/list/TableList'),
87-
meta: { title: 'menu.list.table-list', keepAlive: true, permission: [ 'table' ] }
86+
meta: { title: 'menu.list.table-list', keepAlive: true, permission: ['table'] }
8887
},
8988
{
9089
path: '/list/basic-list',
9190
name: 'BasicList',
9291
component: () => import('@/views/list/BasicList'),
93-
meta: { title: 'menu.list.basic-list', keepAlive: true, permission: [ 'table' ] }
92+
meta: { title: 'menu.list.basic-list', keepAlive: true, permission: ['table'] }
9493
},
9594
{
9695
path: '/list/card',
9796
name: 'CardList',
9897
component: () => import('@/views/list/CardList'),
99-
meta: { title: 'menu.list.card-list', keepAlive: true, permission: [ 'table' ] }
98+
meta: { title: 'menu.list.card-list', keepAlive: true, permission: ['table'] }
10099
},
101100
{
102101
path: '/list/search',
103102
name: 'SearchList',
104103
component: () => import('@/views/list/search/SearchLayout'),
105104
redirect: '/list/search/article',
106-
meta: { title: 'menu.list.search-list', keepAlive: true, permission: [ 'table' ] },
105+
meta: { title: 'menu.list.search-list', keepAlive: true, permission: ['table'] },
107106
children: [
108107
{
109108
path: '/list/search/article',
110109
name: 'SearchArticles',
111110
component: () => import('../views/list/search/Article'),
112-
meta: { title: 'menu.list.search-list.articles', permission: [ 'table' ] }
111+
meta: { title: 'menu.list.search-list.articles', permission: ['table'] }
113112
},
114113
{
115114
path: '/list/search/project',
116115
name: 'SearchProjects',
117116
component: () => import('../views/list/search/Projects'),
118-
meta: { title: 'menu.list.search-list.projects', permission: [ 'table' ] }
117+
meta: { title: 'menu.list.search-list.projects', permission: ['table'] }
119118
},
120119
{
121120
path: '/list/search/application',
122121
name: 'SearchApplications',
123122
component: () => import('../views/list/search/Applications'),
124-
meta: { title: 'menu.list.search-list.applications', permission: [ 'table' ] }
123+
meta: { title: 'menu.list.search-list.applications', permission: ['table'] }
125124
}
126125
]
127126
}
@@ -134,19 +133,19 @@ export const asyncRouterMap = [
134133
name: 'profile',
135134
component: RouteView,
136135
redirect: '/profile/basic',
137-
meta: { title: 'menu.profile', icon: 'profile', permission: [ 'profile' ] },
136+
meta: { title: 'menu.profile', icon: 'profile', permission: ['profile'] },
138137
children: [
139138
{
140139
path: '/profile/basic',
141140
name: 'ProfileBasic',
142141
component: () => import('@/views/profile/basic'),
143-
meta: { title: 'menu.profile.basic', permission: [ 'profile' ] }
142+
meta: { title: 'menu.profile.basic', permission: ['profile'] }
144143
},
145144
{
146145
path: '/profile/advanced',
147146
name: 'ProfileAdvanced',
148147
component: () => import('@/views/profile/advanced/Advanced'),
149-
meta: { title: 'menu.profile.advanced', permission: [ 'profile' ] }
148+
meta: { title: 'menu.profile.advanced', permission: ['profile'] }
150149
}
151150
]
152151
},
@@ -157,19 +156,19 @@ export const asyncRouterMap = [
157156
name: 'result',
158157
component: RouteView,
159158
redirect: '/result/success',
160-
meta: { title: 'menu.result', icon: 'check-circle-o', permission: [ 'result' ] },
159+
meta: { title: 'menu.result', icon: 'check-circle-o', permission: ['result'] },
161160
children: [
162161
{
163162
path: '/result/success',
164163
name: 'ResultSuccess',
165164
component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
166-
meta: { title: 'menu.result.success', keepAlive: false, hiddenHeaderContent: true, permission: [ 'result' ] }
165+
meta: { title: 'menu.result.success', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
167166
},
168167
{
169168
path: '/result/fail',
170169
name: 'ResultFail',
171170
component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
172-
meta: { title: 'menu.result.fail', keepAlive: false, hiddenHeaderContent: true, permission: [ 'result' ] }
171+
meta: { title: 'menu.result.fail', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
173172
}
174173
]
175174
},
@@ -180,25 +179,25 @@ export const asyncRouterMap = [
180179
name: 'exception',
181180
component: RouteView,
182181
redirect: '/exception/403',
183-
meta: { title: 'menu.exception', icon: 'warning', permission: [ 'exception' ] },
182+
meta: { title: 'menu.exception', icon: 'warning', permission: ['exception'] },
184183
children: [
185184
{
186-
path: '/exception/403',
185+
path: '/exception/403',
187186
name: 'Exception403',
188187
component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
189-
meta: { title: 'menu.exception.not-permission', permission: [ 'exception' ] }
188+
meta: { title: 'menu.exception.not-permission', permission: ['exception'] }
190189
},
191190
{
192191
path: '/exception/404',
193192
name: 'Exception404',
194193
component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
195-
meta: { title: 'menu.exception.not-find', permission: [ 'exception' ] }
194+
meta: { title: 'menu.exception.not-find', permission: ['exception'] }
196195
},
197196
{
198197
path: '/exception/500',
199198
name: 'Exception500',
200199
component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
201-
meta: { title: 'menu.exception.server-error', permission: [ 'exception' ] }
200+
meta: { title: 'menu.exception.server-error', permission: ['exception'] }
202201
}
203202
]
204203
},
@@ -209,51 +208,61 @@ export const asyncRouterMap = [
209208
component: RouteView,
210209
redirect: '/account/center',
211210
name: 'account',
212-
meta: { title: 'menu.account', icon: 'user', keepAlive: true, permission: [ 'user' ] },
211+
meta: { title: 'menu.account', icon: 'user', keepAlive: true, permission: ['user'] },
213212
children: [
214-
{
213+
{
215214
path: '/account/center',
216215
name: 'center',
217216
component: () => import('@/views/account/center'),
218-
meta: { title: 'menu.account.center', keepAlive: true, permission: [ 'user' ] }
217+
meta: { title: 'menu.account.center', keepAlive: true, permission: ['user'] }
219218
},
220219
{
221220
path: '/account/settings',
222221
name: 'settings',
223222
component: () => import('@/views/account/settings/Index'),
224-
meta: { title: 'menu.account.settings', hideHeader: true, permission: [ 'user' ] },
223+
meta: { title: 'menu.account.settings', hideHeader: true, permission: ['user'] },
225224
redirect: '/account/settings/basic',
226225
hideChildrenInMenu: true,
227226
children: [
228227
{
229228
path: '/account/settings/basic',
230229
name: 'BasicSettings',
231230
component: () => import('@/views/account/settings/BasicSetting'),
232-
meta: { title: 'account.settings.menuMap.basic', hidden: true, permission: [ 'user' ] }
231+
meta: { title: 'account.settings.menuMap.basic', hidden: true, permission: ['user'] }
233232
},
234233
{
235234
path: '/account/settings/security',
236235
name: 'SecuritySettings',
237236
component: () => import('@/views/account/settings/Security'),
238-
meta: { title: '安全设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
237+
meta: {
238+
title: 'account.settings.menuMap.security',
239+
hidden: true,
240+
keepAlive: true,
241+
permission: ['user']
242+
}
239243
},
240244
{
241245
path: '/account/settings/custom',
242246
name: 'CustomSettings',
243247
component: () => import('@/views/account/settings/Custom'),
244-
meta: { title: '个性化设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
248+
meta: { title: 'account.settings.menuMap.custom', hidden: true, keepAlive: true, permission: ['user'] }
245249
},
246250
{
247251
path: '/account/settings/binding',
248252
name: 'BindingSettings',
249253
component: () => import('@/views/account/settings/Binding'),
250-
meta: { title: '账户绑定', hidden: true, keepAlive: true, permission: [ 'user' ] }
254+
meta: { title: 'account.settings.menuMap.binding', hidden: true, keepAlive: true, permission: ['user'] }
251255
},
252256
{
253257
path: '/account/settings/notification',
254258
name: 'NotificationSettings',
255259
component: () => import('@/views/account/settings/Notification'),
256-
meta: { title: '新消息通知', hidden: true, keepAlive: true, permission: [ 'user' ] }
260+
meta: {
261+
title: 'account.settings.menuMap.notification',
262+
hidden: true,
263+
keepAlive: true,
264+
permission: ['user']
265+
}
257266
}
258267
]
259268
}
@@ -325,7 +334,9 @@ export const asyncRouterMap = [
325334
]
326335
},
327336
{
328-
path: '*', redirect: '/404', hidden: true
337+
path: '*',
338+
redirect: '/404',
339+
hidden: true
329340
}
330341
]
331342

@@ -367,5 +378,4 @@ export const constantRouterMap = [
367378
path: '/404',
368379
component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
369380
}
370-
371381
]

src/locales/lang/en-US.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import antdEnUS from 'ant-design-vue/es/locale-provider/en_US'
22
import momentEU from 'moment/locale/eu'
3+
import global from './en-US/global'
4+
35
import menu from './en-US/menu'
46
import setting from './en-US/setting'
57
import dashboard from './en-US/dashboard'
@@ -14,12 +16,13 @@ const components = {
1416
}
1517

1618
export default {
17-
'message': '-',
19+
message: '-',
1820

1921
'layouts.usermenu.dialog.title': 'Message',
2022
'layouts.usermenu.dialog.content': 'Are you sure you would like to logout?',
2123

2224
...components,
25+
...global,
2326
...menu,
2427
...setting,
2528
...dashboard,

src/locales/lang/en-US/global.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
submit: 'Submit',
3+
save: 'Save',
4+
'submit.ok': 'Submit successfully',
5+
'save.ok': 'Saved successfully'
6+
}

src/locales/lang/zh-CN.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import antd from 'ant-design-vue/es/locale-provider/zh_CN'
22
import momentCN from 'moment/locale/zh-cn'
3+
import global from './zh-CN/global'
4+
35
import menu from './zh-CN/menu'
46
import dashboard from './zh-CN/dashboard'
57
import form from './zh-CN/form'
@@ -13,12 +15,13 @@ const components = {
1315
}
1416

1517
export default {
16-
'message': '-',
18+
message: '-',
1719

1820
'layouts.usermenu.dialog.title': '信息',
1921
'layouts.usermenu.dialog.content': '您确定要注销吗?',
2022

2123
...components,
24+
...global,
2225
...menu,
2326
...dashboard,
2427
...form,

src/locales/lang/zh-CN/global.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
submit: '提交',
3+
save: '保存',
4+
'submit.ok': '提交成功',
5+
'save.ok': '保存成功'
6+
}

src/views/account/settings/BasicSetting.vue

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,11 @@
1919
:label="$t('account.settings.basic.email')"
2020
:required="false"
2121
>
22-
<a-input placeholder="[email protected]"/>
23-
</a-form-item>
24-
<a-form-item
25-
label="加密方式"
26-
:required="false"
27-
>
28-
<a-select defaultValue="aes-256-cfb">
29-
<a-select-option value="aes-256-cfb">aes-256-cfb</a-select-option>
30-
<a-select-option value="aes-128-cfb">aes-128-cfb</a-select-option>
31-
<a-select-option value="chacha20">chacha20</a-select-option>
32-
</a-select>
33-
</a-form-item>
34-
<a-form-item
35-
label="连接密码"
36-
:required="false"
37-
>
38-
<a-input placeholder="h3gSbecd"/>
39-
</a-form-item>
40-
<a-form-item
41-
label="登录密码"
42-
:required="false"
43-
>
44-
<a-input placeholder="密码"/>
22+
<a-input placeholder="[email protected]"/>
4523
</a-form-item>
4624

4725
<a-form-item>
48-
<a-button type="primary">提交</a-button>
49-
<a-button style="margin-left: 8px">保存</a-button>
26+
<a-button type="primary">{{ $t('account.settings.basic.update') }}</a-button>
5027
</a-form-item>
5128
</a-form>
5229

src/views/account/settings/Index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</div>
4040
<div class="account-settings-info-right">
4141
<div class="account-settings-info-title">
42-
<span>{{ $route.meta.title }}</span>
42+
<span>{{ $t($route.meta.title) }}</span>
4343
</div>
4444
<route-view></route-view>
4545
</div>

0 commit comments

Comments
 (0)