@@ -19,6 +19,7 @@ import './icons/icon-loading';
1919import { ToastManager } from './lit-toast' ;
2020import baseStyles from './styles/base' ;
2121import varStyles from './styles/var' ;
22+ import { msg } from '@lit/localize' ;
2223
2324export class BaseForm extends LitElement {
2425 @consume ( { context : baseUrlContext } )
@@ -99,7 +100,7 @@ export class BaseForm extends LitElement {
99100 const response = await fetch ( `/apis/api.commentwidget.halo.run/v1alpha1/captcha/-/generate` ) ;
100101
101102 if ( ! response . ok ) {
102- this . toastManager ?. error ( '获取验证码失败' ) ;
103+ this . toastManager ?. error ( msg ( 'Failed to obtain verification code' ) ) ;
103104 return ;
104105 }
105106
@@ -111,7 +112,13 @@ export class BaseForm extends LitElement {
111112 }
112113
113114 async handleLogout ( ) {
114- if ( window . confirm ( '点击确定将跳转至退出登录页面,请确保正在编辑的内容已保存。' ) ) {
115+ if (
116+ window . confirm (
117+ msg (
118+ 'Click OK to jump to the logout page, Please make sure the content being edited has been saved.'
119+ )
120+ )
121+ ) {
115122 try {
116123 window . location . href = '/logout' ;
117124 } catch ( error ) {
@@ -125,7 +132,7 @@ export class BaseForm extends LitElement {
125132 ${ this . currentUser ?. spec . avatar ? html `<img src= ${ this . currentUser . spec . avatar } / > ` : '' }
126133 <span> ${ this . currentUser ?. spec . displayName || this . currentUser ?. metadata . name } </ span>
127134 <butto n @click = ${ this . handleLogout } type= "button" class = "form__button--logout" >
128- 退出登录
135+ ${ msg ( 'Logout' ) }
129136 </ butto n>
130137 </ div> ` ;
131138 }
@@ -169,7 +176,7 @@ export class BaseForm extends LitElement {
169176 <textarea
170177 class= "form__editor"
171178 ${ ref ( this . textareaRef ) }
172- placeholder = "编写评论"
179+ placeholder = ${ msg ( 'Write a comment' ) }
173180 rows= "4"
174181 name= "content"
175182 required
@@ -182,23 +189,23 @@ export class BaseForm extends LitElement {
182189 name= "displayName"
183190 value = ${ this . customAccount . displayName }
184191 type= "text"
185- placeholder= "昵称"
192+ placeholder= ${ msg ( 'Nicename' ) }
186193 required
187194 / >
188195 <input
189196 name= "email"
190197 value = ${ this . customAccount . email }
191198 type= "email"
192- placeholder= "电子邮件"
199+ placeholder= ${ msg ( 'Email' ) }
193200 required
194201 / >
195202 <input
196203 name= "website"
197204 value = ${ this . customAccount . website }
198205 type= "url"
199- placeholder= "网站"
206+ placeholder= ${ msg ( 'Website' ) }
200207 / >
201- <a href= ${ this . loginUrl } rel= "nofollow" > (或登录账号) </ a>
208+ <a href= ${ this . loginUrl } rel= "nofollow" > ${ msg ( '(Or login)' ) } </ a>
202209 </ div> `
203210 : '' }
204211
@@ -210,14 +217,18 @@ export class BaseForm extends LitElement {
210217 class= "form__button--login"
211218 type = "butto n"
212219 >
213- 登录
220+ ${ msg ( 'Login' ) }
214221 </ butto n> `
215222 : '' }
216223 <div class= "form__actions" >
217224 ${ this . showCaptcha
218225 ? html `
219226 <div class= "form__action--captcha" >
220- <input name= "captchaCode" type = "text" placeholder= "请输入验证码" / >
227+ <input
228+ name= "captchaCode"
229+ type = "text"
230+ placeholder= ${ msg ( 'Please enter the verification code' ) }
231+ / >
221232 <img
222233 @click = ${ this . handleFetchCaptcha }
223234 src= "${ this . captcha } "
@@ -243,7 +254,7 @@ export class BaseForm extends LitElement {
243254 d = "M8 7.71L18 12L8 16.29v-3.34l7.14-.95L8 11.05V7.71M12 2a10 10 0 0 1 10 10a10 10 0 0 1-10 10A10 10 0 0 1 2 12A10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8Z"
244255 > </ path>
245256 </ svg> ` }
246- 提交评论
257+ ${ msg ( 'Submit' ) }
247258 </ butto n>
248259 </ div>
249260 </ div>
0 commit comments