From 1947a544f2597ea62011db9572d6c5273f9e921d Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sun, 29 Sep 2024 16:15:46 +0800 Subject: [PATCH] feat: refine i18n resources for login-related page (#6726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area core /kind improvement /milestone 2.20.x #### What this PR does / why we need it: 完善新登录相关页面的多语言资源文件。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/6721 #### Does this PR introduce a user-facing change? ```release-note None ``` --- .../src/main/resources/static/js/main.js | 5 +- .../challenges/two-factor/totp.properties | 2 +- .../challenges/two-factor/totp_es.properties | 4 + .../two-factor/totp_zh_TW.properties | 4 + .../gateway_modules/common_fragments.html | 16 +- .../common_fragments.properties | 4 +- .../common_fragments_en.properties | 4 +- .../common_fragments_es.properties | 3 + .../common_fragments_zh_TW.properties | 3 + .../login_fragments_en.properties | 2 +- .../login_fragments_es.properties | 13 + .../login_fragments_zh_TW.properties | 13 + .../resources/templates/login_es.properties | 1 + .../templates/login_local_es.properties | 3 + .../templates/login_local_zh_TW.properties | 3 + .../templates/login_zh_TW.properties | 1 + .../resources/templates/logout_es.properties | 3 + .../templates/logout_zh_TW.properties | 3 + .../templates/password-reset-link.html | 4 +- .../password-reset-link_es.properties | 5 + .../password-reset-link_zh_TW.properties | 5 + .../resources/templates/password-reset.html | 4 +- .../templates/password-reset_es.properties | 6 + .../templates/password-reset_zh_TW.properties | 6 + .../src/main/resources/templates/signup.html | 284 +++++++++--------- .../resources/templates/signup.properties | 3 +- .../resources/templates/signup_en.properties | 15 +- .../resources/templates/signup_es.properties | 14 + .../templates/signup_zh_TW.properties | 14 + 29 files changed, 289 insertions(+), 158 deletions(-) create mode 100644 application/src/main/resources/templates/challenges/two-factor/totp_es.properties create mode 100644 application/src/main/resources/templates/challenges/two-factor/totp_zh_TW.properties create mode 100644 application/src/main/resources/templates/gateway_modules/common_fragments_es.properties create mode 100644 application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties create mode 100644 application/src/main/resources/templates/gateway_modules/login_fragments_es.properties create mode 100644 application/src/main/resources/templates/gateway_modules/login_fragments_zh_TW.properties create mode 100644 application/src/main/resources/templates/login_es.properties create mode 100644 application/src/main/resources/templates/login_local_es.properties create mode 100644 application/src/main/resources/templates/login_local_zh_TW.properties create mode 100644 application/src/main/resources/templates/login_zh_TW.properties create mode 100644 application/src/main/resources/templates/logout_es.properties create mode 100644 application/src/main/resources/templates/logout_zh_TW.properties create mode 100644 application/src/main/resources/templates/password-reset-link_es.properties create mode 100644 application/src/main/resources/templates/password-reset-link_zh_TW.properties create mode 100644 application/src/main/resources/templates/password-reset_es.properties create mode 100644 application/src/main/resources/templates/password-reset_zh_TW.properties create mode 100644 application/src/main/resources/templates/signup_es.properties create mode 100644 application/src/main/resources/templates/signup_zh_TW.properties diff --git a/application/src/main/resources/static/js/main.js b/application/src/main/resources/static/js/main.js index 2db2e606b1..727b25abf4 100644 --- a/application/src/main/resources/static/js/main.js +++ b/application/src/main/resources/static/js/main.js @@ -96,14 +96,14 @@ function sendVerificationCode(button, sendRequest) { sendRequest() .then(() => { startCountdown(); - Toast.success("发送成功"); + Toast.success(i18nResources.sendVerificationCodeSuccess); }) .catch((e) => { button.disabled = false; if (e instanceof Error) { Toast.error(e.message); } else { - Toast.error("发送失败,请稍后再试"); + Toast.error(i18nResources.sendVerificationCodeFailed); } }); }); @@ -151,4 +151,3 @@ document.addEventListener("DOMContentLoaded", () => { } }); }); - diff --git a/application/src/main/resources/templates/challenges/two-factor/totp.properties b/application/src/main/resources/templates/challenges/two-factor/totp.properties index 46f96ed978..dfea51a906 100644 --- a/application/src/main/resources/templates/challenges/two-factor/totp.properties +++ b/application/src/main/resources/templates/challenges/two-factor/totp.properties @@ -1,4 +1,4 @@ title=两步验证 messages.invalidError=错误的验证码 form.code.label=验证码 -form.submit=验证 +form.submit=验证 \ No newline at end of file diff --git a/application/src/main/resources/templates/challenges/two-factor/totp_es.properties b/application/src/main/resources/templates/challenges/two-factor/totp_es.properties new file mode 100644 index 0000000000..43e5e25e1c --- /dev/null +++ b/application/src/main/resources/templates/challenges/two-factor/totp_es.properties @@ -0,0 +1,4 @@ +title=Autenticación en Dos Pasos +messages.invalidError=Código de verificación incorrecto +form.code.label=Código de Verificación +form.submit=Verificar \ No newline at end of file diff --git a/application/src/main/resources/templates/challenges/two-factor/totp_zh_TW.properties b/application/src/main/resources/templates/challenges/two-factor/totp_zh_TW.properties new file mode 100644 index 0000000000..a2be3bc9c4 --- /dev/null +++ b/application/src/main/resources/templates/challenges/two-factor/totp_zh_TW.properties @@ -0,0 +1,4 @@ +title=兩步驗證 +messages.invalidError=錯誤的驗證碼 +form.code.label=驗證碼 +form.submit=驗證 diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments.html b/application/src/main/resources/templates/gateway_modules/common_fragments.html index 75d718ca33..dc5df4b1bb 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments.html +++ b/application/src/main/resources/templates/gateway_modules/common_fragments.html @@ -1,13 +1,14 @@ + + + - - - @@ -67,7 +68,10 @@ const selectedLanguage = document.getElementById("language-select").value; const currentURL = new URL(window.location.href); currentURL.searchParams.set("language", selectedLanguage); - window.location.href = currentURL.toString(); + + history.replaceState(null, "", currentURL.toString()); + + window.location.reload(); } diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments.properties b/application/src/main/resources/templates/gateway_modules/common_fragments.properties index 6617dd0d7b..f079f83e50 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments.properties +++ b/application/src/main/resources/templates/gateway_modules/common_fragments.properties @@ -1 +1,3 @@ -socialLogin.label=社交登录 \ No newline at end of file +socialLogin.label=社交登录 +js.sendVerificationCode.success=发送成功 +js.sendVerificationCode.failed=发送失败,请稍后再试 \ No newline at end of file diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties b/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties index a10abbb87c..cb299c93a5 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties +++ b/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties @@ -1 +1,3 @@ -socialLogin.label=Social Login \ No newline at end of file +socialLogin.label=Social Login +js.sendVerificationCode.success=Sent Successfully +js.sendVerificationCode.failed=Sending Failed, Please Try Again Later \ No newline at end of file diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments_es.properties b/application/src/main/resources/templates/gateway_modules/common_fragments_es.properties new file mode 100644 index 0000000000..cbda753fe4 --- /dev/null +++ b/application/src/main/resources/templates/gateway_modules/common_fragments_es.properties @@ -0,0 +1,3 @@ +socialLogin.label=Inicio de Sesión Social +js.sendVerificationCode.success=Enviado con éxito +js.sendVerificationCode.failed=Error al enviar, por favor intente nuevamente más tarde \ No newline at end of file diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties b/application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties new file mode 100644 index 0000000000..d55ad22de9 --- /dev/null +++ b/application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties @@ -0,0 +1,3 @@ +socialLogin.label=社交登入 +js.sendVerificationCode.success=發送成功 +js.sendVerificationCode.failed=發送失敗,請稍後再試 \ No newline at end of file diff --git a/application/src/main/resources/templates/gateway_modules/login_fragments_en.properties b/application/src/main/resources/templates/gateway_modules/login_fragments_en.properties index d3b5b33f46..90daeec12b 100644 --- a/application/src/main/resources/templates/gateway_modules/login_fragments_en.properties +++ b/application/src/main/resources/templates/gateway_modules/login_fragments_en.properties @@ -1,6 +1,6 @@ messages.loginError=Invalid credentials. messages.logoutSuccess=Logout successfully. -messages.signupSuccess=Congratulations! Sign up successfully, please sign in now. +messages.signupSuccess=Congratulations! Sign up successfully, please login now. error.invalid-credential=Invalid credentials. error.rate-limit-exceeded=Too many requests, please try again later. diff --git a/application/src/main/resources/templates/gateway_modules/login_fragments_es.properties b/application/src/main/resources/templates/gateway_modules/login_fragments_es.properties new file mode 100644 index 0000000000..ae350b0a6b --- /dev/null +++ b/application/src/main/resources/templates/gateway_modules/login_fragments_es.properties @@ -0,0 +1,13 @@ +messages.loginError=Credenciales inválidas. +messages.logoutSuccess=Cierre de sesión exitoso. +messages.signupSuccess=¡Felicidades! Registro exitoso, por favor inicie sesión de inmediato. + +error.invalid-credential=Credenciales inválidas. +error.rate-limit-exceeded=Demasiadas solicitudes, por favor intente nuevamente más tarde. + +form.rememberMe.label=Mantener sesión iniciada +form.submit=Iniciar sesión +otherLogin.label=Otras formas de inicio de sesión +signup.description=¿No tienes una cuenta? +signup.link=Regístrate ahora +returnToSite=Volver al sitio diff --git a/application/src/main/resources/templates/gateway_modules/login_fragments_zh_TW.properties b/application/src/main/resources/templates/gateway_modules/login_fragments_zh_TW.properties new file mode 100644 index 0000000000..42fb89cc01 --- /dev/null +++ b/application/src/main/resources/templates/gateway_modules/login_fragments_zh_TW.properties @@ -0,0 +1,13 @@ +messages.loginError=無效的憑證。 +messages.logoutSuccess=登出成功。 +messages.signupSuccess=恭喜!註冊成功,請立即登入。 + +error.invalid-credential=無效的憑證。 +error.rate-limit-exceeded=請求過於頻繁,請稍後再試。 + +form.rememberMe.label=保持登入會話 +form.submit=登入 +otherLogin.label=其他登入方式 +signup.description=沒有帳號? +signup.link=立即註冊 +returnToSite=返回網站 diff --git a/application/src/main/resources/templates/login_es.properties b/application/src/main/resources/templates/login_es.properties new file mode 100644 index 0000000000..44915466c1 --- /dev/null +++ b/application/src/main/resources/templates/login_es.properties @@ -0,0 +1 @@ +title=Iniciar Sesión diff --git a/application/src/main/resources/templates/login_local_es.properties b/application/src/main/resources/templates/login_local_es.properties new file mode 100644 index 0000000000..a13f85b92d --- /dev/null +++ b/application/src/main/resources/templates/login_local_es.properties @@ -0,0 +1,3 @@ +form.username.label=Nombre de Usuario +form.password.label=Contraseña +form.password.forgot=¿Olvidaste tu contraseña? diff --git a/application/src/main/resources/templates/login_local_zh_TW.properties b/application/src/main/resources/templates/login_local_zh_TW.properties new file mode 100644 index 0000000000..83af5dba38 --- /dev/null +++ b/application/src/main/resources/templates/login_local_zh_TW.properties @@ -0,0 +1,3 @@ +form.username.label=使用者名稱 +form.password.label=密碼 +form.password.forgot=忘記密碼? \ No newline at end of file diff --git a/application/src/main/resources/templates/login_zh_TW.properties b/application/src/main/resources/templates/login_zh_TW.properties new file mode 100644 index 0000000000..9f1b2d337b --- /dev/null +++ b/application/src/main/resources/templates/login_zh_TW.properties @@ -0,0 +1 @@ +title=登入 diff --git a/application/src/main/resources/templates/logout_es.properties b/application/src/main/resources/templates/logout_es.properties new file mode 100644 index 0000000000..ab74ddb056 --- /dev/null +++ b/application/src/main/resources/templates/logout_es.properties @@ -0,0 +1,3 @@ +title=Cerrar Sesión +form.title=¿Estás seguro de que deseas cerrar sesión? +form.submit=Cerrar Sesión diff --git a/application/src/main/resources/templates/logout_zh_TW.properties b/application/src/main/resources/templates/logout_zh_TW.properties new file mode 100644 index 0000000000..8d8fddf093 --- /dev/null +++ b/application/src/main/resources/templates/logout_zh_TW.properties @@ -0,0 +1,3 @@ +title=退出登入 +form.title=確定要退出登入嗎? +form.submit=退出登入 diff --git a/application/src/main/resources/templates/password-reset-link.html b/application/src/main/resources/templates/password-reset-link.html index 2a40d4d81b..5ce127ab34 100644 --- a/application/src/main/resources/templates/password-reset-link.html +++ b/application/src/main/resources/templates/password-reset-link.html @@ -34,6 +34,8 @@

+ +
- \ No newline at end of file + diff --git a/application/src/main/resources/templates/password-reset-link_es.properties b/application/src/main/resources/templates/password-reset-link_es.properties new file mode 100644 index 0000000000..406600dace --- /dev/null +++ b/application/src/main/resources/templates/password-reset-link_es.properties @@ -0,0 +1,5 @@ +title=Cambiar Contraseña para {0} +form.password.label=Contraseña +form.confirmPassword.label=Confirmar Contraseña +form.password.tips=La contraseña debe tener al menos 8 caracteres e incluir al menos una letra mayúscula, una letra minúscula, un número y un carácter especial. +form.submit=Cambiar Contraseña diff --git a/application/src/main/resources/templates/password-reset-link_zh_TW.properties b/application/src/main/resources/templates/password-reset-link_zh_TW.properties new file mode 100644 index 0000000000..6b6a4c5bcd --- /dev/null +++ b/application/src/main/resources/templates/password-reset-link_zh_TW.properties @@ -0,0 +1,5 @@ +title=為 {0} 修改密碼 +form.password.label=密碼 +form.confirmPassword.label=確認密碼 +form.password.tips=密碼必須至少包含 8 個字元,並且至少包含一個大寫字母、一個小寫字母、一個數字和一個特殊字元。 +form.submit=修改密碼 diff --git a/application/src/main/resources/templates/password-reset.html b/application/src/main/resources/templates/password-reset.html index 3e198e1427..782a9a3a34 100644 --- a/application/src/main/resources/templates/password-reset.html +++ b/application/src/main/resources/templates/password-reset.html @@ -31,6 +31,8 @@

+ +
- + \ No newline at end of file diff --git a/application/src/main/resources/templates/password-reset_es.properties b/application/src/main/resources/templates/password-reset_es.properties new file mode 100644 index 0000000000..671e3e29e2 --- /dev/null +++ b/application/src/main/resources/templates/password-reset_es.properties @@ -0,0 +1,6 @@ +title=Restablecer Contraseña +form.email.label=Correo Electrónico +form.submit=Enviar +sent.form.submit=Volver a la Página de Inicio de Sesión +sent.form.message=Revisa tu correo electrónico para ver el enlace de restablecimiento de contraseña. Si no aparece en unos minutos, revisa tu carpeta de spam. +sent.title=Correo de Restablecimiento de Contraseña Enviado diff --git a/application/src/main/resources/templates/password-reset_zh_TW.properties b/application/src/main/resources/templates/password-reset_zh_TW.properties new file mode 100644 index 0000000000..9b773cd893 --- /dev/null +++ b/application/src/main/resources/templates/password-reset_zh_TW.properties @@ -0,0 +1,6 @@ +title=重置密碼 +form.email.label=電子郵件 +form.submit=提交 +sent.form.submit=返回到登入頁面 +sent.form.message=檢查您的電子郵件中是否有重置密碼的連結。如果幾分鐘內沒有出現,請檢查您的垃圾郵件資料夾。 +sent.title=已發送重置密碼的郵件 diff --git a/application/src/main/resources/templates/signup.html b/application/src/main/resources/templates/signup.html index 01186b5ae3..c1937a2d80 100644 --- a/application/src/main/resources/templates/signup.html +++ b/application/src/main/resources/templates/signup.html @@ -1,36 +1,42 @@ - - - - -