Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
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
ai-tech
dify
Commits
b346bd9b
Unverified
Commit
b346bd9b
authored
Aug 22, 2023
by
Matri
Committed by
GitHub
Aug 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: default language improvement in activation page (#942)
parent
062e2e91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
activateForm.tsx
web/app/activate/activateForm.tsx
+5
-3
No files found.
web/app/activate/activateForm.tsx
View file @
b346bd9b
...
...
@@ -22,7 +22,7 @@ const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
const
ActivateForm
=
()
=>
{
const
{
t
}
=
useTranslation
()
const
{
locale
}
=
useContext
(
I18n
)
const
{
locale
,
setLocaleOnClient
}
=
useContext
(
I18n
)
const
searchParams
=
useSearchParams
()
const
workspaceID
=
searchParams
.
get
(
'workspace_id'
)
const
email
=
searchParams
.
get
(
'email'
)
...
...
@@ -45,6 +45,7 @@ const ActivateForm = () => {
const
[
timezone
,
setTimezone
]
=
useState
(
'Asia/Shanghai'
)
const
[
language
,
setLanguage
]
=
useState
(
'en-US'
)
const
[
showSuccess
,
setShowSuccess
]
=
useState
(
false
)
const
defaultLanguage
=
(
navigator
.
language
?.
startsWith
(
'zh'
)
?
languageMaps
[
'zh-Hans'
]
:
languageMaps
.
en
)
||
languageMaps
.
en
const
showErrorMessage
=
(
message
:
string
)
=>
{
Toast
.
notify
({
...
...
@@ -83,6 +84,7 @@ const ActivateForm = () => {
timezone
,
},
})
setLocaleOnClient
(
language
.
startsWith
(
'en'
)
?
'en'
:
'zh-Hans'
)
setShowSuccess
(
true
)
}
catch
{
...
...
@@ -93,7 +95,7 @@ const ActivateForm = () => {
return
(
<
div
className=
{
cn
(
'flex flex-col items-center w-full grow
items-center
justify-center'
,
'flex flex-col items-center w-full grow justify-center'
,
'px-6'
,
'md:px-[108px]'
,
)
...
...
@@ -167,7 +169,7 @@ const ActivateForm = () => {
</
label
>
<
div
className=
"relative mt-1 rounded-md shadow-sm"
>
<
SimpleSelect
defaultValue=
{
languageMaps
.
en
}
defaultValue=
{
defaultLanguage
}
items=
{
languages
}
onSelect=
{
(
item
)
=>
{
setLanguage
(
item
.
value
as
string
)
...
...
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