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
{
useTranslation
}
from
"
react-i18next
"
;
import
{
Select
}
from
"
@/ui/Shared
"
;
export
const
I18NSelector
:
React
.
FC
=
()
=>
{
const
{
i18n
}
=
useTranslation
();
const
onClickLanguageChange
=
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
{
const
language
=
e
.
target
.
value
;
const
onClickLanguageChange
=
(
language
:
any
)
=>
{
i18n
.
changeLanguage
(
language
);
};
...
...
@@ -15,14 +16,18 @@ export const I18NSelector: React.FC = () => {
},
[
i18n
.
language
]);
return
(
<
select
value=
{
i18n
.
language
}
onChange=
{
onClickLanguageChange
}
>
<
option
value=
"cn"
>
Chinese
</
option
>
<
option
value=
"en"
>
English
</
option
>
<
option
value=
"fr"
>
French
</
option
>
<
option
value=
"jp"
>
Japanese
</
option
>
<
option
value=
"br"
>
Brazilian
</
option
>
<
option
value=
"pt"
>
Portuguese
</
option
>
<
option
value=
"es"
>
Spanish
</
option
>
</
select
>
<
Select
value=
{
i18n
.
language
}
onChange=
{
onClickLanguageChange
}
options=
{
[
{
value
:
"
cn
"
,
label
:
"
简体中文
"
},
{
value
:
"
en
"
,
label
:
"
English
"
},
{
value
:
"
fr
"
,
label
:
"
Français
"
},
{
value
:
"
jp
"
,
label
:
"
日本語
"
},
{
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";
import
styles
from
"
./index.module.scss
"
;
export
const
Select
:
React
.
FC
<
React
.
ComponentProps
<
typeof
AntdSelect
>
&
{
title
:
string
}
React
.
ComponentProps
<
typeof
AntdSelect
>
&
{
title
?
:
string
}
>
=
({
title
,
className
,
dropdownStyle
,
...
rest
})
=>
(
<
div
className=
{
styles
[
"
custom-select
"
]
}
>
<
span
className=
{
styles
.
prefix
}
>
{
title
}
</
span
>
{
title
&&
<
span
className=
{
styles
.
prefix
}
>
{
title
}
</
span
>
}
<
AntdSelect
className=
{
classNames
(
styles
.
select
,
className
)
}
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