@@ -21,6 +21,7 @@ import { LoginPanel } from 'components/account/LoginPanel'
21
21
import { authAtom } from 'store/auth'
22
22
import { useCurrentSize } from 'utils/useCurrenSize'
23
23
24
+ import { useTranslation } from '../i18n/i18n'
24
25
import {
25
26
GlobalErrorBoundary ,
26
27
withGlobalErrorBoundary ,
@@ -30,6 +31,7 @@ import { EditDialog } from './account/EditDialog'
30
31
import { RegisterPanel } from './account/RegisterPanel'
31
32
32
33
const AccountMenu : FC = ( ) => {
34
+ const t = useTranslation ( )
33
35
const [ authState , setAuthState ] = useAtom ( authAtom )
34
36
const [ logoutDialogOpen , setLogoutDialogOpen ] = useState ( false )
35
37
const [ editDialogOpen , setEditDialogOpen ] = useState ( false )
@@ -39,24 +41,24 @@ const AccountMenu: FC = () => {
39
41
setAuthState ( { } )
40
42
AppToaster . show ( {
41
43
intent : 'success' ,
42
- message : '已退出登录' ,
44
+ message : t . components . AccountManager . logout_success ,
43
45
} )
44
46
}
45
47
46
48
return (
47
49
< >
48
50
< Alert
49
51
isOpen = { logoutDialogOpen }
50
- cancelButtonText = "取消"
51
- confirmButtonText = "退出登录"
52
+ cancelButtonText = { t . components . AccountManager . cancel }
53
+ confirmButtonText = { t . components . AccountManager . logout }
52
54
icon = "log-out"
53
55
intent = "danger"
54
56
canOutsideClickCancel
55
57
onCancel = { ( ) => setLogoutDialogOpen ( false ) }
56
58
onConfirm = { handleLogout }
57
59
>
58
- < H4 > 退出登录 </ H4 >
59
- < p > 确定要退出登录吗? </ p >
60
+ < H4 > { t . components . AccountManager . logout } </ H4 >
61
+ < p > { t . components . AccountManager . logout_confirm } </ p >
60
62
</ Alert >
61
63
62
64
< EditDialog
@@ -69,19 +71,22 @@ const AccountMenu: FC = () => {
69
71
< MenuItem
70
72
disabled
71
73
icon = "warning-sign"
72
- text = "账号未激活,请在退出登录后,以重置密码的方式激活"
74
+ text = { t . components . AccountManager . account_not_activated }
73
75
/>
74
76
) }
75
77
76
78
< MenuItem
77
79
icon = "person"
78
- text = { ( isSM ? authState . username + ' - ' : '' ) + '个人主页' }
80
+ text = {
81
+ ( isSM ? authState . username + ' - ' : '' ) +
82
+ t . components . AccountManager . profile
83
+ }
79
84
href = { `/profile/${ authState . userId } ` }
80
85
/>
81
86
< MenuItem
82
87
shouldDismissPopover = { false }
83
88
icon = "edit"
84
- text = "修改信息..."
89
+ text = { t . components . AccountManager . edit_info }
85
90
onClick = { ( ) => setEditDialogOpen ( true ) }
86
91
/>
87
92
< MenuDivider />
@@ -90,7 +95,7 @@ const AccountMenu: FC = () => {
90
95
shouldDismissPopover = { false }
91
96
intent = "danger"
92
97
icon = "log-out"
93
- text = "退出登录"
98
+ text = { t . components . AccountManager . logout }
94
99
onClick = { ( ) => setLogoutDialogOpen ( true ) }
95
100
/>
96
101
</ Menu >
@@ -102,11 +107,12 @@ export const AccountAuthDialog: ComponentType<{
102
107
open ?: boolean
103
108
onClose ?: ( ) => void
104
109
} > = withGlobalErrorBoundary ( ( { open, onClose } ) => {
110
+ const t = useTranslation ( )
105
111
const [ activeTab , setActiveTab ] = useState < TabId > ( 'login' )
106
112
107
113
return (
108
114
< Dialog
109
- title = "PRTS Plus 账户"
115
+ title = { t . components . AccountManager . maa_account }
110
116
icon = "user"
111
117
isOpen = { open }
112
118
onClose = { onClose }
@@ -127,7 +133,9 @@ export const AccountAuthDialog: ComponentType<{
127
133
title = {
128
134
< div >
129
135
< Icon icon = "person" />
130
- < span className = "ml-1" > 登录</ span >
136
+ < span className = "ml-1" >
137
+ { t . components . AccountManager . login }
138
+ </ span >
131
139
</ div >
132
140
}
133
141
panel = {
@@ -142,7 +150,9 @@ export const AccountAuthDialog: ComponentType<{
142
150
title = {
143
151
< div >
144
152
< Icon icon = "new-person" />
145
- < span className = "ml-1" > 注册</ span >
153
+ < span className = "ml-1" >
154
+ { t . components . AccountManager . register }
155
+ </ span >
146
156
</ div >
147
157
}
148
158
panel = { < RegisterPanel onComplete = { ( ) => setActiveTab ( 'login' ) } /> }
@@ -155,6 +165,7 @@ export const AccountAuthDialog: ComponentType<{
155
165
} )
156
166
157
167
export const AccountManager : ComponentType = withGlobalErrorBoundary ( ( ) => {
168
+ const t = useTranslation ( )
158
169
const [ open , setOpen ] = useState ( false )
159
170
const [ authState ] = useAtom ( authAtom )
160
171
const { isSM } = useCurrentSize ( )
@@ -173,7 +184,7 @@ export const AccountManager: ComponentType = withGlobalErrorBoundary(() => {
173
184
</ Popover2 >
174
185
) : (
175
186
< Button className = "ml-auto" icon = "user" onClick = { ( ) => setOpen ( true ) } >
176
- { ! isSM && '登录 / 注册' }
187
+ { ! isSM && t . components . AccountManager . login_register }
177
188
</ Button >
178
189
) }
179
190
</ >
0 commit comments