Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
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
duanledexianxianxian
pro-blocks
Commits
b972b883
Commit
b972b883
authored
Dec 12, 2018
by
Javier Arias
Committed by
偏右
Dec 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use mapping in locale
parent
3bece1fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
24 deletions
+21
-24
src/components/SelectLang/index.js
src/components/SelectLang/index.js
+21
-24
No files found.
src/components/SelectLang/index.js
View file @
b972b883
...
@@ -13,32 +13,29 @@ export default class SelectLang extends PureComponent {
...
@@ -13,32 +13,29 @@ export default class SelectLang extends PureComponent {
render
()
{
render
()
{
const
{
className
}
=
this
.
props
;
const
{
className
}
=
this
.
props
;
const
selectedLang
=
getLocale
();
const
selectedLang
=
getLocale
();
const
locales
=
[
"
zh-CN
"
,
"
zh-TW
"
,
"
en-US
"
,
"
pt-BR
"
];
const
languageLabels
=
{
"
zh-CN
"
:
"
简体中文
"
,
"
zh-TW
"
:
"
繁体中文
"
,
"
en-US
"
:
"
English
"
,
"
pt-BR
"
:
"
Português
"
,
};
const
languageIcons
=
{
"
zh-CN
"
:
"
🇨🇳
"
,
"
zh-TW
"
:
"
🇭🇰
"
,
"
en-US
"
:
"
🇬🇧
"
,
"
pt-BR
"
:
"
🇵🇹
"
,
};
const
langMenu
=
(
const
langMenu
=
(
<
Menu
className
=
{
styles
.
menu
}
selectedKeys
=
{[
selectedLang
]}
onClick
=
{
this
.
changeLang
}
>
<
Menu
className
=
{
styles
.
menu
}
selectedKeys
=
{[
selectedLang
]}
onClick
=
{
this
.
changeLang
}
>
<
Menu
.
Item
key
=
"
zh-CN
"
>
{
locales
.
map
(
locale
=>
(
<
span
role
=
"
img
"
aria
-
label
=
"
简体中文
"
>
<
Menu
.
Item
key
=
{
locale
}
>
🇨🇳
<
span
role
=
"
img
"
aria
-
label
=
{
languageLabels
[
locale
]}
>
<
/span>{' '
}
{
languageIcons
[
locale
]}
简体中文
<
/span>{' '
}
<
/Menu.Item
>
{
languageLabels
[
locale
]}
<
Menu
.
Item
key
=
"
zh-TW
"
>
<
/Menu.Item
>
<
span
role
=
"
img
"
aria
-
label
=
"
繁体中文
"
>
))}
🇭🇰
<
/span>{' '
}
繁体中文
<
/Menu.Item
>
<
Menu
.
Item
key
=
"
en-US
"
>
<
span
role
=
"
img
"
aria
-
label
=
"
English
"
>
🇬🇧
<
/span>{' '
}
English
<
/Menu.Item
>
<
Menu
.
Item
key
=
"
pt-BR
"
>
<
span
role
=
"
img
"
aria
-
label
=
"
Português
"
>
🇵🇹
<
/span>{' '
}
Português
<
/Menu.Item
>
<
/Menu
>
<
/Menu
>
);
);
return
(
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