Skip to content

Commit 69787fd

Browse files
CopilotTechQuery
andcommitted
Translate all hardcoded text and clean up unused i18n keys
Co-authored-by: TechQuery <[email protected]>
1 parent 68bd527 commit 69787fd

File tree

5 files changed

+60
-35
lines changed

5 files changed

+60
-35
lines changed

components/Organization/Charts.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ const OrganizationCharts: FC<OrganizationStatistic> = observer(
1616
return (
1717
<div style={{ minHeight: '70vh' }}>
1818
<SVGCharts>
19-
<Title>NGO 地区分布</Title>
19+
<Title>{t('ngo_area_distribution')}</Title>
2020
<XAxis type="category" data={areaList.map(([key]) => key)} />
2121
<YAxis type="value" />
2222
<BarSeries data={areaList.map(([{}, value]) => value)} />
2323
<Tooltip />
2424
</SVGCharts>
2525

2626
<SVGCharts>
27-
<Title>NGO 服务分布</Title>
27+
<Title>{t('ngo_service_distribution')}</Title>
2828
<XAxis type="category" data={categoryList.map(([key]) => key)} />
2929
<YAxis type="value" />
3030
<BarSeries data={categoryList.map(([{}, value]) => value)} />
3131
<Tooltip />
3232
</SVGCharts>
3333

3434
<SVGCharts className="col-auto">
35-
<Title>NGO 类型分布</Title>
35+
<Title>{t('ngo_type_distribution')}</Title>
3636
<PieSeries data={typeList.map(([name, value]) => ({ name, value }))} />
3737
<Tooltip trigger="item" />
3838
</SVGCharts>

pages/index.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
import { observer } from 'mobx-react';
2+
import { FC, useContext } from 'react';
13
import { Card, Col, Row } from 'react-bootstrap';
24
import { renderToStaticMarkup } from 'react-dom/server';
35
import ReactTyped from 'react-typed-component';
46

57
import { PageHead } from '../components/Layout/PageHead';
8+
import { I18nContext } from '../models/Translation';
69
import styles from '../styles/Home.module.scss';
710

8-
const HomePage = () => (
11+
const HomePage: FC = observer(() => {
12+
const { t } = useContext(I18nContext);
13+
14+
return (
915
<>
1016
<PageHead />
1117

@@ -38,7 +44,7 @@ const HomePage = () => (
3844
),
3945
renderToStaticMarkup(
4046
<>
41-
欢迎参与<strong>开放式协作</strong>
47+
{t('welcome_open_collaboration')}<strong>{t('open_collaboration')}</strong>
4248
</>,
4349
),
4450
renderToStaticMarkup(
@@ -54,11 +60,11 @@ const HomePage = () => (
5460
<section
5561
className={`flex-fill d-flex flex-column justify-content-center align-items-center pb-0 bg-warning bg-opacity-10 ${styles.main}`}
5662
>
57-
<h2 className="text-start mb-5 mt-5 fw-bolder">参与</h2>
63+
<h2 className="text-start mb-5 mt-5 fw-bolder">{t('participate')}</h2>
5864
<Row className="flex-fill d-flex justify-content-around align-items-center w-100 px-3">
5965
<Col xs={8} sm={7} md={4} className="pb-5">
6066
<Card body className={`shadow ${styles.activeCard}`}>
61-
<h5 className="fw-bold mb-3">代码工作</h5>
67+
<h5 className="fw-bold mb-3">{t('code_work')}</h5>
6268
<ul className="list-unstyled">
6369
<li className="mb-3">
6470
<a
@@ -77,7 +83,7 @@ const HomePage = () => (
7783
</Col>
7884
<Col xs={8} sm={7} md={4} className="pb-5">
7985
<Card body className={`shadow overflow-auto ${styles.activeCard}`}>
80-
<h5 className="fw-bold mb-3">非代码工作</h5>
86+
<h5 className="fw-bold mb-3">{t('non_code_work')}</h5>
8187
<ul className="list-unstyled">
8288
<li className="mb-3">
8389
<a href="/history" className="fw-bold">
@@ -113,12 +119,12 @@ const HomePage = () => (
113119
<section
114120
className={`flex-fill d-flex flex-column justify-content-center align-items-center pb-0 bg-success bg-opacity-10 ${styles.main}`}
115121
>
116-
<h2 className="text-start mb-5 fw-bolder h1">行动</h2>
122+
<h2 className="text-start mb-5 fw-bolder h1">{t('action')}</h2>
117123
<Row className="d-flex flex-column justify-content-start align-items-center w-100 mb-5">
118124
<Col className="text-center">
119125
<figure className="text-center">
120126
<blockquote className="blockquote mb-4">
121-
<p className="h2">我们正在筹办 3 月开源市集,欢迎参与!</p>
127+
<p className="h2">{t('we_are_organizing_bazaar')}</p>
122128
</blockquote>
123129
<figcaption className="h6 text-muted">
124130
即兴三月,开源开放!来都来了,玩就是了!👉
@@ -134,6 +140,7 @@ const HomePage = () => (
134140
</Row>
135141
</section>
136142
</>
137-
);
143+
);
144+
});
138145

139146
export default HomePage;

translation/en-US.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,6 @@ export default {
9898
China_NGO_Landscape: 'China Public Interest Landscape',
9999
open_source_public_interest_plan: 'Open Source Public Interest Plan',
100100
landscape: 'Landscape',
101-
join_the_public_interest_map: 'Join the Public Interest Map',
102-
about_China_NGO_Map: 'About China Public Interest Map',
103-
China_NGO_Map_description:
104-
'China Public Interest Map is a visualization platform showcasing the distribution and development status of public interest organizations in China, helping the public understand the current state of the public interest ecosystem.',
105-
by_year: 'By Year',
106-
by_city: 'By City',
107-
by_type: 'By Type',
108-
by_tag: 'By Tag',
109101
organizations: 'Organizations',
110102
no_data_available: 'No data available',
111103

@@ -120,4 +112,18 @@ export default {
120112
landscape_data_loading_message:
121113
'Public interest organization data is loading, please try again later.',
122114
visit_website: 'Visit Website',
115+
116+
// Chart distribution titles
117+
ngo_area_distribution: 'NGO Area Distribution',
118+
ngo_service_distribution: 'NGO Service Distribution',
119+
ngo_type_distribution: 'NGO Type Distribution',
120+
121+
// Home page sections
122+
participate: 'Participate',
123+
code_work: 'Code Work',
124+
non_code_work: 'Non-Code Work',
125+
action: 'Action',
126+
we_are_organizing_bazaar: 'We are organizing the March Open Source Bazaar, welcome to participate!',
127+
welcome_open_collaboration: 'Welcome to participate in',
128+
open_collaboration: 'Open Collaboration',
123129
};

translation/zh-CN.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ export default {
9797
China_NGO_Landscape: '中国公益生态图',
9898
open_source_public_interest_plan: '开源公益计划',
9999
landscape: '生态图',
100-
join_the_public_interest_map: '加入公益地图',
101-
about_China_NGO_Map: '关于中国公益地图',
102-
China_NGO_Map_description:
103-
'中国公益地图是一个展示中国公益组织分布和发展状况的可视化平台,帮助公众了解公益生态现状。',
104-
by_year: '按年份',
105-
by_city: '按城市',
106-
by_type: '按类型',
107-
by_tag: '按标签',
108100
organizations: '组织',
109101
no_data_available: '暂无数据',
110102
landscape_data_loading_message: '公益组织数据正在加载中,请稍后再试。',
@@ -118,4 +110,18 @@ export default {
118110
tag: '标签',
119111
total: '共',
120112
visit_website: '访问官网',
113+
114+
// Chart distribution titles
115+
ngo_area_distribution: 'NGO 地区分布',
116+
ngo_service_distribution: 'NGO 服务分布',
117+
ngo_type_distribution: 'NGO 类型分布',
118+
119+
// Home page sections
120+
participate: '参与',
121+
code_work: '代码工作',
122+
non_code_work: '非代码工作',
123+
action: '行动',
124+
we_are_organizing_bazaar: '我们正在筹办 3 月开源市集,欢迎参与!',
125+
welcome_open_collaboration: '欢迎参与',
126+
open_collaboration: '开放式协作',
121127
};

translation/zh-TW.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ export default {
9797
China_NGO_Landscape: '中國公益生態圖',
9898
open_source_public_interest_plan: '開源公益計劃',
9999
landscape: '生態圖',
100-
join_the_public_interest_map: '加入公益地圖',
101-
about_China_NGO_Map: '關於中國公益地圖',
102-
China_NGO_Map_description:
103-
'中國公益地圖是一個展示中國公益組織分佈和發展狀況的可視化平台,幫助公眾瞭解公益生態現狀。',
104-
by_year: '按年份',
105-
by_city: '按城市',
106-
by_type: '按類型',
107-
by_tag: '按標籤',
108100
organizations: '組織',
109101
no_data_available: '暫無數據',
110102
landscape_data_loading_message: '公益組織數據正在加載中,請稍後再試。',
@@ -118,4 +110,18 @@ export default {
118110
tag: '標籤',
119111
total: '共',
120112
visit_website: '訪問官網',
113+
114+
// Chart distribution titles
115+
ngo_area_distribution: 'NGO 地區分佈',
116+
ngo_service_distribution: 'NGO 服務分佈',
117+
ngo_type_distribution: 'NGO 類型分佈',
118+
119+
// Home page sections
120+
participate: '參與',
121+
code_work: '代碼工作',
122+
non_code_work: '非代碼工作',
123+
action: '行動',
124+
we_are_organizing_bazaar: '我們正在籌辦 3 月開源市集,歡迎參與!',
125+
welcome_open_collaboration: '歡迎參與',
126+
open_collaboration: '開放式協作',
121127
};

0 commit comments

Comments
 (0)