Skip to content

Commit

Permalink
fix: switch language bug (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyhuang18 authored Mar 7, 2023
1 parent 177d0a6 commit 76de787
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 10 additions & 4 deletions src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const { Header } = Layout;

const MyHeader = () => {
const { t } = useTranslation();
const [language, setLanguage] = useState('zh');
const [language, setLanguage] = useState(i18n.language);
const changeLanguage = () => {
let lan = language;
let lan;
if (language == 'zh') {
lan = 'en';
message.info('switched to English');
Expand All @@ -34,7 +34,7 @@ const MyHeader = () => {
<QA type="word" />
</Menu.Item>
<Menu.Item key="translate">
<a href="javascript:;" onClick={changeLanguage}>
<a href="javascript:" onClick={changeLanguage}>
中/En
</a>
</Menu.Item>
Expand All @@ -48,8 +48,13 @@ const MyHeader = () => {
<img
style={{ height: '45px', width: '36px' }}
src={'/pics/Main Logo.png'}
alt={t('loading')}
/>
<img
style={{ width: '185px' }}
src={'/pics/OpenLeaderboard.png'}
alt={t('loading')}
/>
<img style={{ width: '185px' }} src={'/pics/OpenLeaderboard.png'} />
</div>
<div className="header-pc">
<Dictionary />
Expand All @@ -58,6 +63,7 @@ const MyHeader = () => {
style={{ height: '48px', width: '48px', cursor: 'pointer' }}
onClick={changeLanguage}
src="/pics/translation.png"
alt={t('loading')}
/>
</div>
<div className="header-phone">
Expand Down
6 changes: 3 additions & 3 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"item": "Item: ",
"region": "Region: ",
"developer": "Developer",
"loading": "loading",
"loading": "Loading",
"month": "Monthly",
"year": "Yearly",
"rank": "Rank",
Expand All @@ -32,13 +32,13 @@
"open_pulls": "Open PRs",
"merge_pulls": "Merge PRs",
"pr_reviews": "PR Reviews",
"analysisConclusion": "The table below shows the OpenIsight-Index rankings for GitHub activity and influence up to end of November 2021. Positions are compared to the rankings at the end of October. As for activity The top 4 leading organizations remain consistent this month with QingCloud progressing well above their closest neighbour’s growth figures,Contrastingly Alibaba, JD and Bytedance also see a decline in their activity this month. As for influence... ",
"analysisConclusion": "The table below shows the OpenInsight-Index rankings for GitHub activity and influence up to end of November 2021. Positions are compared to the rankings at the end of October. As for activity The top 4 leading organizations remain consistent this month with QingCloud progressing well above their closest neighbour’s growth figures,Contrastingly Alibaba, JD and Bytedance also see a decline in their activity this month. As for influence... ",
"contributeProject": "miss your project?",
"contributeCompany": "miss your company?",
"tip": "miss your item?",
"introduction": "Welcome to OpenInsight-Index, where Chinese companies, projects and robot accounts are ranked by the activity and influence on GitHub.",
"updateTime": "Updated December 1st, 2021",
"openinsight": "Openinsight is a complete set of tools integrating open source data collection, open source data development and open source data visualization. It can solve the open source data analysis and reporting in a one-stop way. It has a professional and in-depth understanding of various indicators of various open source projects to help the community operate reasonably.",
"openinsight": "OpenInsight is a complete set of tools integrating open source data collection, open source data development and open source data visualization. It can solve the open source data analysis and reporting in a one-stop way. It has a professional and in-depth understanding of various indicators of various open source projects to help the community operate reasonably.",
"opendigger": "OpenDigger is an open source analysis report project for all open source data initiated by X-lab, this project aims to combine the wisdom of global developers to jointly analyze and insight into open source related data to help everyone better understand and participate in open source.",
"Question": {
"Q1": "Your business or project is not here, and how to add it?",
Expand Down

0 comments on commit 76de787

Please sign in to comment.