Skip to content

Commit e64c005

Browse files
committed
[add] Language Menu component
[optimize] translate texts of pages & messages
1 parent e2be773 commit e64c005

File tree

12 files changed

+175
-93
lines changed

12 files changed

+175
-93
lines changed

.github/workflows/Lark-notification.yml

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,30 @@ jobs:
3939
msg_type: post
4040
content: |
4141
post:
42-
en_us:
43-
title: "GitHub issue opened: ${{ steps.issue_content.outputs.issue_title }}"
42+
zh_cn:
43+
title: "GitHub issue 打开:${{ steps.issue_content.outputs.issue_title }}"
4444
content:
4545
- - tag: text
46-
text: "Link: "
46+
text: 链接:
4747
- tag: a
4848
text: ${{ github.event.issue.html_url }}
4949
href: ${{ github.event.issue.html_url }}
5050
- - tag: text
51-
text: "Author: "
51+
text: 作者:
5252
- tag: a
5353
text: ${{ github.event.issue.user.login }}
5454
href: ${{ github.event.issue.user.html_url }}
5555
- - tag: text
56-
text: "Assignee: "
56+
text: 指派:
5757
- tag: a
5858
text: "${{ github.event.issue.assignee.login }}"
5959
href: "${{ github.event.issue.assignee.html_url }}"
6060
- - tag: text
61-
text: "Labels: ${{ github.event.issue.labels }}"
61+
text: 标签:${{ github.event.issue.labels }}
6262
- - tag: text
63-
text: "Milestone: ${{ github.event.issue.milestone.title }}"
63+
text: 里程碑:${{ github.event.issue.milestone.title }}
6464
- - tag: text
65-
text: "Description: "
65+
text: 描述:
6666
- tag: text
6767
text: "${{ steps.issue_content.outputs.issue_body }}"
6868
@@ -74,30 +74,30 @@ jobs:
7474
msg_type: post
7575
content: |
7676
post:
77-
en_us:
78-
title: "GitHub issue edited: ${{ steps.issue_content.outputs.issue_title }}"
77+
zh_cn:
78+
title: "GitHub issue 编辑:${{ steps.issue_content.outputs.issue_title }}"
7979
content:
8080
- - tag: text
81-
text: "Link: "
81+
text: 链接:
8282
- tag: a
8383
text: ${{ github.event.issue.html_url }}
8484
href: ${{ github.event.issue.html_url }}
8585
- - tag: text
86-
text: "Author: "
86+
text: 作者:
8787
- tag: a
8888
text: ${{ github.event.issue.user.login }}
8989
href: ${{ github.event.issue.user.html_url }}
9090
- - tag: text
91-
text: "Assignee: "
91+
text: 指派:
9292
- tag: a
9393
text: "${{ github.event.issue.assignee.login }}"
9494
href: "${{ github.event.issue.assignee.html_url }}"
9595
- - tag: text
96-
text: "Labels: ${{ github.event.issue.labels }}"
96+
text: 标签:${{ github.event.issue.labels }}
9797
- - tag: text
98-
text: "Milestone: ${{ github.event.issue.milestone.title }}"
98+
text: 里程碑:${{ github.event.issue.milestone.title }}
9999
- - tag: text
100-
text: "Description: "
100+
text: 描述:
101101
- tag: text
102102
text: "${{ steps.issue_content.outputs.issue_body }}"
103103
@@ -109,30 +109,30 @@ jobs:
109109
msg_type: post
110110
content: |
111111
post:
112-
en_us:
113-
title: "GitHub issue closed: ${{ steps.issue_content.outputs.issue_title }}"
112+
zh_cn:
113+
title: "GitHub issue 关闭:${{ steps.issue_content.outputs.issue_title }}"
114114
content:
115115
- - tag: text
116-
text: "Link: "
116+
text: 链接:
117117
- tag: a
118118
text: ${{ github.event.issue.html_url }}
119119
href: ${{ github.event.issue.html_url }}
120120
- - tag: text
121-
text: "Author: "
121+
text: 作者:
122122
- tag: a
123123
text: ${{ github.event.issue.user.login }}
124124
href: ${{ github.event.issue.user.html_url }}
125125
- - tag: text
126-
text: "Assignee: "
126+
text: 指派:
127127
- tag: a
128128
text: "${{ github.event.issue.assignee.login }}"
129129
href: "${{ github.event.issue.assignee.html_url }}"
130130
- - tag: text
131-
text: "Labels: ${{ github.event.issue.labels }}"
131+
text: 标签:${{ github.event.issue.labels }}
132132
- - tag: text
133-
text: "Milestone: ${{ github.event.issue.milestone.title }}"
133+
text: 里程碑:${{ github.event.issue.milestone.title }}
134134
- - tag: text
135-
text: "Description: "
135+
text: 描述:
136136
- tag: text
137137
text: "${{ steps.issue_content.outputs.issue_body }}"
138138
@@ -163,30 +163,30 @@ jobs:
163163
msg_type: post
164164
content: |
165165
post:
166-
en_us:
167-
title: "GitHub PR opened: ${{ steps.PR_content.outputs.PR_title }}"
166+
zh_cn:
167+
title: "GitHub PR 打开:${{ steps.PR_content.outputs.PR_title }}"
168168
content:
169169
- - tag: text
170-
text: "Link: "
170+
text: 链接:
171171
- tag: a
172172
text: ${{ github.event.pull_request.html_url }}
173173
href: ${{ github.event.pull_request.html_url }}
174174
- - tag: text
175-
text: "Author: "
175+
text: 作者:
176176
- tag: a
177177
text: ${{ github.event.pull_request.user.login }}
178178
href: ${{ github.event.pull_request.user.html_url }}
179179
- - tag: text
180-
text: "Assignee: "
180+
text: 指派:
181181
- tag: a
182182
text: "${{ github.event.pull_request.assignee.login }}"
183183
href: "${{ github.event.pull_request.assignee.html_url }}"
184184
- - tag: text
185-
text: "Labels: ${{ github.event.pull_request.labels }}"
185+
text: 标签:${{ github.event.pull_request.labels }}
186186
- - tag: text
187-
text: "Milestone: ${{ github.event.pull_request.milestone.title }}"
187+
text: 里程碑:${{ github.event.pull_request.milestone.title }}
188188
- - tag: text
189-
text: "Description: "
189+
text: 描述:
190190
- tag: text
191191
text: "${{ steps.PR_content.outputs.PR_body }}"
192192
@@ -198,30 +198,30 @@ jobs:
198198
msg_type: post
199199
content: |
200200
post:
201-
en_us:
202-
title: "GitHub PR edited: ${{ steps.PR_content.outputs.PR_title }}"
201+
zh_cn:
202+
title: "GitHub PR 编辑:${{ steps.PR_content.outputs.PR_title }}"
203203
content:
204204
- - tag: text
205-
text: "Link: "
205+
text: 链接:
206206
- tag: a
207207
text: ${{ github.event.pull_request.html_url }}
208208
href: ${{ github.event.pull_request.html_url }}
209209
- - tag: text
210-
text: "Author: "
210+
text: 作者:
211211
- tag: a
212212
text: ${{ github.event.pull_request.user.login }}
213213
href: ${{ github.event.pull_request.user.html_url }}
214214
- - tag: text
215-
text: "Assignee: "
215+
text: 指派:
216216
- tag: a
217217
text: "${{ github.event.pull_request.assignee.login }}"
218218
href: "${{ github.event.pull_request.assignee.html_url }}"
219219
- - tag: text
220-
text: "Labels: ${{ github.event.pull_request.labels }}"
220+
text: 标签:${{ github.event.pull_request.labels }}
221221
- - tag: text
222-
text: "Milestone: ${{ github.event.pull_request.milestone.title }}"
222+
text: 里程碑:${{ github.event.pull_request.milestone.title }}
223223
- - tag: text
224-
text: "Description: "
224+
text: 描述:
225225
- tag: text
226226
text: "${{ steps.PR_content.outputs.PR_body }}"
227227
@@ -233,30 +233,30 @@ jobs:
233233
msg_type: post
234234
content: |
235235
post:
236-
en_us:
237-
title: "GitHub PR closed: ${{ steps.PR_content.outputs.PR_title }}"
236+
zh_cn:
237+
title: "GitHub PR 关闭:${{ steps.PR_content.outputs.PR_title }}"
238238
content:
239239
- - tag: text
240-
text: "Link: "
240+
text: 链接:
241241
- tag: a
242242
text: ${{ github.event.pull_request.html_url }}
243243
href: ${{ github.event.pull_request.html_url }}
244244
- - tag: text
245-
text: "Author: "
245+
text: 作者:
246246
- tag: a
247247
text: ${{ github.event.pull_request.user.login }}
248248
href: ${{ github.event.pull_request.user.html_url }}
249249
- - tag: text
250-
text: "Assignee: "
250+
text: 指派:
251251
- tag: a
252252
text: "${{ github.event.pull_request.assignee.login }}"
253253
href: "${{ github.event.pull_request.assignee.html_url }}"
254254
- - tag: text
255-
text: "Labels: ${{ github.event.pull_request.labels }}"
255+
text: 标签:${{ github.event.pull_request.labels }}
256256
- - tag: text
257-
text: "Milestone: ${{ github.event.pull_request.milestone.title }}"
257+
text: 里程碑:${{ github.event.pull_request.milestone.title }}
258258
- - tag: text
259-
text: "Description: "
259+
text: 描述:
260260
- tag: text
261261
text: "${{ steps.PR_content.outputs.PR_body }}"
262262
@@ -287,25 +287,25 @@ jobs:
287287
msg_type: post
288288
content: |
289289
post:
290-
en_us:
291-
title: "GitHub discussion created: ${{ steps.discussion_content.outputs.discussion_title }}"
290+
zh_cn:
291+
title: "GitHub 帖子发布:${{ steps.discussion_content.outputs.discussion_title }}"
292292
content:
293293
- - tag: text
294-
text: "Link: "
294+
text: 链接:
295295
- tag: a
296296
text: ${{ github.event.discussion.html_url }}
297297
href: ${{ github.event.discussion.html_url }}
298298
- - tag: text
299-
text: "Author: "
299+
text: 作者:
300300
- tag: a
301301
text: ${{ github.event.discussion.user.login }}
302302
href: ${{ github.event.discussion.user.html_url }}
303303
- - tag: text
304-
text: "Category: ${{ github.event.discussion.category }}"
304+
text: 分类:${{ github.event.discussion.category }}
305305
- - tag: text
306-
text: "Labels: ${{ github.event.discussion.labels }}"
306+
text: 标签:${{ github.event.discussion.labels }}
307307
- - tag: text
308-
text: "Description: "
308+
text: 描述:
309309
- tag: text
310310
text: "${{ steps.discussion_content.outputs.discussion_body }}"
311311
@@ -317,25 +317,25 @@ jobs:
317317
msg_type: post
318318
content: |
319319
post:
320-
en_us:
321-
title: "GitHub discussion edited: ${{ steps.discussion_content.outputs.discussion_title }}"
320+
zh_cn:
321+
title: "GitHub 帖子修改:${{ steps.discussion_content.outputs.discussion_title }}"
322322
content:
323323
- - tag: text
324-
text: "Link: "
324+
text: 链接:
325325
- tag: a
326326
text: ${{ github.event.discussion.html_url }}
327327
href: ${{ github.event.discussion.html_url }}
328328
- - tag: text
329-
text: "Author: "
329+
text: 作者:
330330
- tag: a
331331
text: ${{ github.event.discussion.user.login }}
332332
href: ${{ github.event.discussion.user.html_url }}
333333
- - tag: text
334-
text: "Category: ${{ github.event.discussion.category }}"
334+
text: 分类:${{ github.event.discussion.category }}
335335
- - tag: text
336-
text: "Labels: ${{ github.event.discussion.labels }}"
336+
text: 标签:${{ github.event.discussion.labels }}
337337
- - tag: text
338-
text: "Description: "
338+
text: 描述:
339339
- tag: text
340340
text: "${{ steps.discussion_content.outputs.discussion_body }}"
341341
@@ -359,20 +359,20 @@ jobs:
359359
msg_type: post
360360
content: |
361361
post:
362-
en_us:
363-
title: "GitHub comment: ${{ steps.issue_content.outputs.issue_title }}"
362+
zh_cn:
363+
title: "GitHub 帖子评论:${{ steps.issue_content.outputs.issue_title }}"
364364
content:
365365
- - tag: text
366-
text: "Link: "
366+
text: 链接:
367367
- tag: a
368368
text: ${{ github.event.comment.html_url }}
369369
href: ${{ github.event.comment.html_url }}
370370
- - tag: text
371-
text: "Author: "
371+
text: 作者:
372372
- tag: a
373373
text: ${{ github.event.comment.user.login }}
374374
href: ${{ github.event.comment.user.html_url }}
375375
- - tag: text
376-
text: "Description: "
376+
text: 描述:
377377
- tag: text
378378
text: "${{ steps.comment_body.outputs.comment_body }}"

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@ jobs:
3535
msg_type: post
3636
content: |
3737
post:
38-
en_us:
39-
title: "Vercel Preview Environment"
38+
zh_cn:
39+
title: Vercel 预览环境
4040
content:
4141
- - tag: text
42-
text: "Git Repository: "
42+
text: Git 仓库:
4343
- tag: a
4444
text: ${{ github.server_url }}/${{ github.repository }}
4545
href: ${{ github.server_url }}/${{ github.repository }}
4646
- - tag: text
47-
text: "Code Branch: "
47+
text: 代码分支:
4848
- tag: a
4949
text: ${{ github.ref }}
5050
href: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}
5151
- - tag: text
52-
text: "Commit Author: "
52+
text: 提交作者:
5353
- tag: a
5454
text: ${{ github.actor }}
5555
href: ${{ github.server_url }}/${{ github.actor }}
5656
- - tag: text
57-
text: "Preview Link: "
57+
text: 预览链接:
5858
- tag: a
5959
text: ${{ steps.vercel-deployment.outputs.preview-url }}
6060
href: ${{ steps.vercel-deployment.outputs.preview-url }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Option, Select } from 'idea-react';
2+
import { observer } from 'mobx-react';
3+
import { FC } from 'react';
4+
5+
import { i18n, LanguageName } from '../../models/Translation';
6+
7+
const LanguageMenu: FC = observer(() => {
8+
const { currentLanguage } = i18n;
9+
10+
return (
11+
<Select
12+
value={currentLanguage}
13+
onChange={key => i18n.changeLanguage(key as typeof currentLanguage)}
14+
>
15+
{Object.entries(LanguageName).map(([key, name]) => (
16+
<Option key={key} value={key}>
17+
{name}
18+
</Option>
19+
))}
20+
</Select>
21+
);
22+
});
23+
24+
export default LanguageMenu;
File renamed without changes.

components/PageContent/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { FC, PropsWithChildren } from 'react';
33
import { Card, Container } from 'react-bootstrap';
44

55
import styles from '../../styles/Home.module.scss';
6-
import pageContentStyles from './index.module.scss';
6+
import pageContentStyles from './PageContent.module.scss';
77

88
export type PageContentProps = PropsWithChildren<{}>;
99

0 commit comments

Comments
 (0)