Skip to content

Commit e35e3b5

Browse files
committed
[fix] some SSG & i18n bugs
1 parent 69787fd commit e35e3b5

File tree

7 files changed

+81
-101
lines changed

7 files changed

+81
-101
lines changed

components/Navigator/MainNavigator.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ const topNavBarMenu = ({ t }: typeof i18n): MenuItem[] => [
5353
],
5454
},
5555
{
56-
title: t('ngo'),
56+
title: t('NGO'),
5757
subs: [
5858
{ href: '/ngo', title: t('China_NGO_Map') },
5959
{ href: '/ngo/landscape', title: t('China_NGO_Landscape') },
60-
{
61-
href: 'https://open-source-bazaar.feishu.cn/wiki/VGrMwiweVivWrHkTcvpcJTjjnoY',
62-
title: t('open_source_public_interest_plan')
60+
{
61+
href: 'https://open-source-bazaar.feishu.cn/wiki/VGrMwiweVivWrHkTcvpcJTjjnoY',
62+
title: t('Open_Source_NGO_plan'),
6363
},
6464
],
6565
},

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>{t('ngo_area_distribution')}</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>{t('ngo_service_distribution')}</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>{t('ngo_type_distribution')}</Title>
35+
<Title>{t('NGO_type_distribution')}</Title>
3636
<PieSeries data={typeList.map(([name, value]) => ({ name, value }))} />
3737
<Tooltip trigger="item" />
3838
</SVGCharts>

pages/ngo/index.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
1-
import { InferGetStaticPropsType } from 'next';
1+
import { observer } from 'mobx-react';
2+
import { InferGetServerSidePropsType } from 'next';
3+
import { cache, compose, errorLogger } from 'next-ssr-middleware';
4+
import { FC, useContext } from 'react';
5+
import { Container } from 'react-bootstrap';
26

37
import { ZodiacBar } from '../../components/Base/ZodiacBar';
8+
import { PageHead } from '../../components/Layout/PageHead';
49
import { OrganizationModel } from '../../models/Organization';
10+
import { I18nContext } from '../../models/Translation';
511

6-
export const getStaticProps = async () => {
12+
export const getServerSideProps = compose(cache(), errorLogger, async () => {
713
const [startYear, endYear] = await new OrganizationModel().getYearRange();
814

915
return { props: { startYear, endYear } };
10-
};
16+
});
1117

12-
export default function OrganizationHomePage(
13-
props: InferGetStaticPropsType<typeof getStaticProps>,
14-
) {
15-
return <ZodiacBar {...props} itemOf={year => ({ title: year, link: `/NGO/${year}` })} />;
16-
}
18+
const OrganizationHomePage: FC<InferGetServerSidePropsType<typeof getServerSideProps>> = observer(
19+
props => {
20+
const { t } = useContext(I18nContext);
21+
22+
return (
23+
<Container className="py-5">
24+
<PageHead title={t('China_NGO_DB')} />
25+
<h1 className="text-center">{t('China_NGO_DB')}</h1>
26+
27+
<ZodiacBar {...props} itemOf={year => ({ title: year, link: `/NGO/${year}` })} />
28+
</Container>
29+
);
30+
},
31+
);
32+
export default OrganizationHomePage;

pages/search/[model]/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const getServerSideProps = compose<{ model: string }, SearchModelPageProp
3939
);
4040

4141
const SearchNameMap = ({ t }: typeof i18n): Record<string, string> => ({
42-
NGO: t('ngo'),
42+
NGO: t('NGO'),
4343
});
4444

4545
const SearchCardMap: Record<string, CardPageProps['Card']> = {

translation/en-US.ts

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ export default {
1919
load_more: 'Load more...',
2020
no_more: 'No more',
2121

22+
// Home page sections
23+
participate: 'Participate',
24+
code_work: 'Code Work',
25+
non_code_work: 'Non-Code Work',
26+
action: 'Action',
27+
we_are_organizing_bazaar:
28+
'We are organizing the March Open Source Bazaar, welcome to participate!',
29+
welcome_open_collaboration: 'Welcome to participate in',
30+
open_collaboration: 'Open Collaboration',
31+
2232
// Volunteer page
2333
volunteer: 'Volunteer',
2434
online_volunteer: 'Online Volunteer',
@@ -92,38 +102,16 @@ export default {
92102
github_document_description: 'This is a document page based on a GitHub repository.',
93103
view_or_edit_on_github: 'View or edit this content on GitHub',
94104

95-
// China Public Interest Map
96-
ngo: 'NGO',
97-
China_NGO_Map: 'China Public Interest Map',
98-
China_NGO_Landscape: 'China Public Interest Landscape',
99-
open_source_public_interest_plan: 'Open Source Public Interest Plan',
105+
// China NGO Map
106+
NGO: 'NGO',
107+
China_NGO_DB: 'China NGO Database',
108+
China_NGO_Map: 'China NGO Map',
109+
China_NGO_Landscape: 'China NGO Landscape',
110+
Open_Source_NGO_plan: 'Open Source NGO Plan',
100111
landscape: 'Landscape',
101-
organizations: 'Organizations',
102-
no_data_available: 'No data available',
103-
104-
// Organization interface translations
105-
filter: 'Filter',
106-
reset: 'Reset',
107-
map: 'Map',
108-
chart: 'Chart',
109-
type: 'Type',
110-
tag: 'Tag',
111-
total: 'Total',
112-
landscape_data_loading_message:
113-
'Public interest organization data is loading, please try again later.',
114-
visit_website: 'Visit Website',
115112

116113
// 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',
114+
NGO_area_distribution: 'NGO Area Distribution',
115+
NGO_service_distribution: 'NGO Service Distribution',
116+
NGO_type_distribution: 'NGO Type Distribution',
129117
};

translation/zh-CN.ts

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ export default {
1919
load_more: '加载更多……',
2020
no_more: '没有更多',
2121

22+
// Home page sections
23+
participate: '参与',
24+
code_work: '代码工作',
25+
non_code_work: '非代码工作',
26+
action: '行动',
27+
we_are_organizing_bazaar: '我们正在筹办 3 月开源市集,欢迎参与!',
28+
welcome_open_collaboration: '欢迎参与',
29+
open_collaboration: '开放式协作',
30+
2231
// Volunteer page
2332
volunteer: '志愿者',
2433
online_volunteer: '线上志愿者',
@@ -92,36 +101,15 @@ export default {
92101
view_or_edit_on_github: '在 GitHub 上查看或编辑此内容',
93102

94103
// China Public Interest Map
95-
ngo: '公益',
104+
NGO: '公益',
105+
China_NGO_DB: '中国公益数据库',
96106
China_NGO_Map: '中国公益地图',
97107
China_NGO_Landscape: '中国公益生态图',
98-
open_source_public_interest_plan: '开源公益计划',
108+
Open_Source_NGO_plan: '开源公益计划',
99109
landscape: '生态图',
100-
organizations: '组织',
101-
no_data_available: '暂无数据',
102-
landscape_data_loading_message: '公益组织数据正在加载中,请稍后再试。',
103-
104-
// Organization interface translations
105-
filter: '筛选',
106-
reset: '重置',
107-
map: '地图',
108-
chart: '图表',
109-
type: '类型',
110-
tag: '标签',
111-
total: '共',
112-
visit_website: '访问官网',
113110

114111
// 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: '开放式协作',
112+
NGO_area_distribution: 'NGO 地区分布',
113+
NGO_service_distribution: 'NGO 服务分布',
114+
NGO_type_distribution: 'NGO 类型分布',
127115
};

translation/zh-TW.ts

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ export default {
1919
load_more: '加載更多……',
2020
no_more: '沒有更多',
2121

22+
// Home page sections
23+
participate: '參與',
24+
code_work: '代碼工作',
25+
non_code_work: '非代碼工作',
26+
action: '行動',
27+
we_are_organizing_bazaar: '我們正在籌辦 3 月開源市集,歡迎參與!',
28+
welcome_open_collaboration: '歡迎參與',
29+
open_collaboration: '開放式協作',
30+
2231
// Volunteer page
2332
volunteer: '志工',
2433
online_volunteer: '線上志工',
@@ -92,36 +101,15 @@ export default {
92101
view_or_edit_on_github: '在 GitHub 上查看或編輯此內容',
93102

94103
// China Public Interest Map
95-
ngo: '公益',
104+
NGO: '公益',
105+
China_NGO_DB: '中國公益數據庫',
96106
China_NGO_Map: '中國公益地圖',
97107
China_NGO_Landscape: '中國公益生態圖',
98-
open_source_public_interest_plan: '開源公益計劃',
108+
Open_Source_NGO_plan: '開源公益計劃',
99109
landscape: '生態圖',
100-
organizations: '組織',
101-
no_data_available: '暫無數據',
102-
landscape_data_loading_message: '公益組織數據正在加載中,請稍後再試。',
103-
104-
// Organization interface translations
105-
filter: '篩選',
106-
reset: '重置',
107-
map: '地圖',
108-
chart: '圖表',
109-
type: '類型',
110-
tag: '標籤',
111-
total: '共',
112-
visit_website: '訪問官網',
113110

114111
// 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: '開放式協作',
112+
NGO_area_distribution: 'NGO 地區分佈',
113+
NGO_service_distribution: 'NGO 服務分佈',
114+
NGO_type_distribution: 'NGO 類型分佈',
127115
};

0 commit comments

Comments
 (0)