Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
52038d26
Unverified
Commit
52038d26
authored
Nov 29, 2022
by
Zeng1998
Committed by
GitHub
Nov 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update i18n for validator message (#636)
parent
55f37664
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
36 additions
and
15 deletions
+36
-15
ChangeMemberPasswordDialog.tsx
web/src/components/ChangeMemberPasswordDialog.tsx
+1
-1
ChangePasswordDialog.tsx
web/src/components/ChangePasswordDialog.tsx
+1
-1
UpdateAccountDialog.tsx
web/src/components/UpdateAccountDialog.tsx
+1
-1
validator.ts
web/src/helpers/validator.ts
+5
-4
en.json
web/src/locales/en.json
+6
-1
fr.json
web/src/locales/fr.json
+6
-1
vi.json
web/src/locales/vi.json
+6
-1
zh.json
web/src/locales/zh.json
+6
-1
Auth.tsx
web/src/pages/Auth.tsx
+4
-4
No files found.
web/src/components/ChangeMemberPasswordDialog.tsx
View file @
52038d26
...
...
@@ -55,7 +55,7 @@ const ChangeMemberPasswordDialog: React.FC<Props> = (props: Props) => {
const
passwordValidResult
=
validate
(
newPassword
,
validateConfig
);
if
(
!
passwordValidResult
.
result
)
{
toastHelper
.
error
(
`
${
t
(
"common.password"
)}
${
passwordValidResult
.
reason
}
`
);
toastHelper
.
error
(
`
${
t
(
"common.password"
)}
${
t
(
passwordValidResult
.
reason
as
string
)
}
`
);
return
;
}
...
...
web/src/components/ChangePasswordDialog.tsx
View file @
52038d26
...
...
@@ -52,7 +52,7 @@ const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
const
passwordValidResult
=
validate
(
newPassword
,
validateConfig
);
if
(
!
passwordValidResult
.
result
)
{
toastHelper
.
error
(
`
${
t
(
"common.password"
)}
${
passwordValidResult
.
reason
}
`
);
toastHelper
.
error
(
`
${
t
(
"common.password"
)}
${
t
(
passwordValidResult
.
reason
as
string
)
}
`
);
return
;
}
...
...
web/src/components/UpdateAccountDialog.tsx
View file @
52038d26
...
...
@@ -73,7 +73,7 @@ const UpdateAccountDialog: React.FC<Props> = ({ destroy }: Props) => {
const
usernameValidResult
=
validate
(
state
.
username
,
validateConfig
);
if
(
!
usernameValidResult
.
result
)
{
toastHelper
.
error
(
t
(
"common.username"
)
+
": "
+
usernameValidResult
.
reason
);
toastHelper
.
error
(
t
(
"common.username"
)
+
": "
+
t
(
usernameValidResult
.
reason
as
string
)
);
return
;
}
...
...
web/src/helpers/validator.ts
View file @
52038d26
// Validator
// * use for validating form data
const
chineseReg
=
/
[\u
3000
\u
3400-
\u
4DBF
\u
4E00-
\u
9FFF
]
/
;
export
interface
ValidatorConfig
{
...
...
@@ -18,7 +19,7 @@ export function validate(text: string, config: Partial<ValidatorConfig>): { resu
if
(
text
.
length
<
config
.
minLength
)
{
return
{
result
:
false
,
reason
:
"
Too
short"
,
reason
:
"
message.too-
short"
,
};
}
}
...
...
@@ -27,7 +28,7 @@ export function validate(text: string, config: Partial<ValidatorConfig>): { resu
if
(
text
.
length
>
config
.
maxLength
)
{
return
{
result
:
false
,
reason
:
"
Too
long"
,
reason
:
"
message.too-
long"
,
};
}
}
...
...
@@ -35,14 +36,14 @@ export function validate(text: string, config: Partial<ValidatorConfig>): { resu
if
(
config
.
noSpace
&&
text
.
includes
(
" "
))
{
return
{
result
:
false
,
reason
:
"
Don't allow
space"
,
reason
:
"
message.not-allow-
space"
,
};
}
if
(
config
.
noChinese
&&
chineseReg
.
test
(
text
))
{
return
{
result
:
false
,
reason
:
"
Don't allow
chinese"
,
reason
:
"
message.not-allow-
chinese"
,
};
}
...
...
web/src/locales/en.json
View file @
52038d26
...
...
@@ -203,6 +203,11 @@
"resource-filename-updated"
:
"Resource filename changed."
,
"invalid-resource-filename"
:
"Invalid filename."
,
"click-to-save-the-image"
:
"Click to save the image"
,
"generating-the-screenshot"
:
"Generating the screenshot..."
"generating-the-screenshot"
:
"Generating the screenshot..."
,
"count-selected-resources"
:
"Total selected"
,
"too-short"
:
"Too short"
,
"too-long"
:
"Too long"
,
"not-allow-space"
:
"Don't allow space"
,
"not-allow-chinese"
:
"Don't allow chinese"
}
}
web/src/locales/fr.json
View file @
52038d26
...
...
@@ -198,6 +198,11 @@
"resource-filename-updated"
:
"Le nom de fichier de la ressource a changé."
,
"invalid-resource-filename"
:
"Nom de fichier invalide."
,
"click-to-save-the-image"
:
"Cliquez pour enregistrer l'image"
,
"generating-the-screenshot"
:
"Génération de la capture d'écran..."
"generating-the-screenshot"
:
"Génération de la capture d'écran..."
,
"count-selected-resources"
:
"Total selected"
,
"too-short"
:
"Too short"
,
"too-long"
:
"Too long"
,
"not-allow-space"
:
"Don't allow space"
,
"not-allow-chinese"
:
"Don't allow chinese"
}
}
web/src/locales/vi.json
View file @
52038d26
...
...
@@ -197,6 +197,11 @@
"resource-filename-updated"
:
"Tên tệp tài nguyên đã thay đổi."
,
"invalid-resource-filename"
:
"Tên tệp không hợp lệ."
,
"click-to-save-the-image"
:
"Bấm để lưu hình ảnh"
,
"generating-the-screenshot"
:
"Đang tạo ảnh chụp màn hình ..."
"generating-the-screenshot"
:
"Đang tạo ảnh chụp màn hình ..."
,
"count-selected-resources"
:
"Total selected"
,
"too-short"
:
"Too short"
,
"too-long"
:
"Too long"
,
"not-allow-space"
:
"Don't allow space"
,
"not-allow-chinese"
:
"Don't allow chinese"
}
}
web/src/locales/zh.json
View file @
52038d26
...
...
@@ -203,6 +203,11 @@
"resource-filename-updated"
:
"资源文件名更改成功。"
,
"invalid-resource-filename"
:
"无效的资源文件名"
,
"click-to-save-the-image"
:
"点击保存图片"
,
"generating-the-screenshot"
:
"正在生成图片..."
"generating-the-screenshot"
:
"正在生成图片..."
,
"count-selected-resources"
:
"所选资源总数"
,
"too-short"
:
"过短"
,
"too-long"
:
"过长"
,
"not-allow-space"
:
"不允许包含空格"
,
"not-allow-chinese"
:
"不允许包含中文"
}
}
web/src/pages/Auth.tsx
View file @
52038d26
...
...
@@ -49,13 +49,13 @@ const Auth = () => {
const
usernameValidResult
=
validate
(
username
,
validateConfig
);
if
(
!
usernameValidResult
.
result
)
{
toastHelper
.
error
(
t
(
"common.username"
)
+
": "
+
usernameValidResult
.
reason
);
toastHelper
.
error
(
t
(
"common.username"
)
+
": "
+
t
(
usernameValidResult
.
reason
as
string
)
);
return
;
}
const
passwordValidResult
=
validate
(
password
,
validateConfig
);
if
(
!
passwordValidResult
.
result
)
{
toastHelper
.
error
(
t
(
"common.password"
)
+
": "
+
passwordValidResult
.
reason
);
toastHelper
.
error
(
t
(
"common.password"
)
+
": "
+
t
(
passwordValidResult
.
reason
as
string
)
);
return
;
}
...
...
@@ -82,13 +82,13 @@ const Auth = () => {
const
usernameValidResult
=
validate
(
username
,
validateConfig
);
if
(
!
usernameValidResult
.
result
)
{
toastHelper
.
error
(
t
(
"common.username"
)
+
": "
+
usernameValidResult
.
reason
);
toastHelper
.
error
(
t
(
"common.username"
)
+
": "
+
t
(
usernameValidResult
.
reason
as
string
)
);
return
;
}
const
passwordValidResult
=
validate
(
password
,
validateConfig
);
if
(
!
passwordValidResult
.
result
)
{
toastHelper
.
error
(
t
(
"common.password"
)
+
": "
+
passwordValidResult
.
reason
);
toastHelper
.
error
(
t
(
"common.password"
)
+
": "
+
t
(
passwordValidResult
.
reason
as
string
)
);
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment