Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
7a6b2db8
Commit
7a6b2db8
authored
May 19, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize I18NSelector
parent
31d59062
Pipeline
#27199
passed with stages
in 6 minutes and 41 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
src/ui/I18N/I18NSelector/index.tsx
src/ui/I18N/I18NSelector/index.tsx
+16
-11
src/ui/Shared/Select/index.tsx
src/ui/Shared/Select/index.tsx
+2
-2
No files found.
src/ui/I18N/I18NSelector/index.tsx
View file @
7a6b2db8
import
React
,
{
useEffect
}
from
"
react
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
useTranslation
}
from
"
react-i18next
"
;
import
{
useTranslation
}
from
"
react-i18next
"
;
import
{
Select
}
from
"
@/ui/Shared
"
;
export
const
I18NSelector
:
React
.
FC
=
()
=>
{
export
const
I18NSelector
:
React
.
FC
=
()
=>
{
const
{
i18n
}
=
useTranslation
();
const
{
i18n
}
=
useTranslation
();
const
onClickLanguageChange
=
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
{
const
onClickLanguageChange
=
(
language
:
any
)
=>
{
const
language
=
e
.
target
.
value
;
i18n
.
changeLanguage
(
language
);
i18n
.
changeLanguage
(
language
);
};
};
...
@@ -15,14 +16,18 @@ export const I18NSelector: React.FC = () => {
...
@@ -15,14 +16,18 @@ export const I18NSelector: React.FC = () => {
},
[
i18n
.
language
]);
},
[
i18n
.
language
]);
return
(
return
(
<
select
value=
{
i18n
.
language
}
onChange=
{
onClickLanguageChange
}
>
<
Select
<
option
value=
"cn"
>
Chinese
</
option
>
value=
{
i18n
.
language
}
<
option
value=
"en"
>
English
</
option
>
onChange=
{
onClickLanguageChange
}
<
option
value=
"fr"
>
French
</
option
>
options=
{
[
<
option
value=
"jp"
>
Japanese
</
option
>
{
value
:
"
cn
"
,
label
:
"
简体中文
"
},
<
option
value=
"br"
>
Brazilian
</
option
>
{
value
:
"
en
"
,
label
:
"
English
"
},
<
option
value=
"pt"
>
Portuguese
</
option
>
{
value
:
"
fr
"
,
label
:
"
Français
"
},
<
option
value=
"es"
>
Spanish
</
option
>
{
value
:
"
jp
"
,
label
:
"
日本語
"
},
</
select
>
{
value
:
"
br
"
,
label
:
"
português do Brasil
"
},
{
value
:
"
pt
"
,
label
:
"
português
"
},
{
value
:
"
es
"
,
label
:
"
Castellano
"
},
]
}
/>
);
);
};
};
src/ui/Shared/Select/index.tsx
View file @
7a6b2db8
...
@@ -4,10 +4,10 @@ import classNames from "classnames";
...
@@ -4,10 +4,10 @@ import classNames from "classnames";
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
export
const
Select
:
React
.
FC
<
export
const
Select
:
React
.
FC
<
React
.
ComponentProps
<
typeof
AntdSelect
>
&
{
title
:
string
}
React
.
ComponentProps
<
typeof
AntdSelect
>
&
{
title
?
:
string
}
>
=
({
title
,
className
,
dropdownStyle
,
...
rest
})
=>
(
>
=
({
title
,
className
,
dropdownStyle
,
...
rest
})
=>
(
<
div
className=
{
styles
[
"
custom-select
"
]
}
>
<
div
className=
{
styles
[
"
custom-select
"
]
}
>
<
span
className=
{
styles
.
prefix
}
>
{
title
}
</
span
>
{
title
&&
<
span
className=
{
styles
.
prefix
}
>
{
title
}
</
span
>
}
<
AntdSelect
<
AntdSelect
className=
{
classNames
(
styles
.
select
,
className
)
}
className=
{
classNames
(
styles
.
select
,
className
)
}
size=
"large"
size=
"large"
...
...
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