translation and little format fixture

This commit is contained in:
Annie Huang committed 2023-11-20 22:49:46 +08:00
1 parent f6c3b33da9
commit 9da23b5dc1
14 files changed
+155 -54

No files matched your search

+18 -10
View File
@@ -17,11 +17,13 @@ function handleRegister({ username, email, password, success, error }) {
.then(success)
.catch((err) => {
if (err instanceof TooManyRequestsError) {
error('Too many requests. Try again in 2 minutes.')
// error('Too many requests. Try again in 2 minutes.')
error('太多請求,兩分鐘後再試一次。')
return
}
if (err instanceof UnauthorizedError) {
error('Invalid username or password.')
// error('Invalid username or password.')
error('無效的帳號名稱或密碼。')
return
}
if (err instanceof ValidationError) {
@@ -29,23 +31,27 @@ function handleRegister({ username, email, password, success, error }) {
return
}
console.error(err)
error('Something went wrong.')
// error('Something went wrong.')
error('出了點問題。')
})
}
async function check({ username, email, password, error }) {
if (username && !isValidUsername(username)) {
error('Invalid username.')
// error('Invalid username.')
error('無效的帳號名稱')
return
}
if (email && !validator.isEmail(email)) {
error('Invalid email.')
// error('Invalid email.')
error('無效的電子郵件')
return
}
if (password && !validator.isStrongPassword(password, passwordPolicy)) {
error(
'Your password must be 8+ characters with at least one number, one upper and one lower case letter.'
)
// error(
// 'Your password must be 8+ characters with at least one number, one upper and one lower case letter.'
// )
error('密碼必須超過8個字元,至少包含一個數字、一個大寫及一個小寫。')
return
}
try {
@@ -56,11 +62,13 @@ async function check({ username, email, password, error }) {
return
}
if (err instanceof TooManyRequestsError) {
error('Too many requests. Try again in 2 minutes.')
// error('Too many requests. Try again in 2 minutes.')
error('太多請求,兩分鐘後再試一次。')
return
}
console.error(err)
error('Something went wrong.')
// error('Something went wrong.')
error('出了點問題。')
}
}
</script>