Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding missing lang in menu links #126

Merged
merged 2 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions web/src/components/organisms/SearchMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { withRouter } from 'react-router-dom'
import ContextStore from 'ContextStore'
import { DRAWER_CLOSE } from 'reducers/drawer'
import { useTranslation } from 'react-i18next'
import { getCurrentLanguage } from 'utils/helper'

const ExpandedRow = styled(Box)`
&& {
Expand Down Expand Up @@ -36,13 +37,15 @@ const SearchMenu = props => {
dispatch({ type: DRAWER_CLOSE })
}

const currentLanguage = getCurrentLanguage()

return (
<>
<LeftMargin>
<Typography
variant="h5"
color="secondary"
onClick={() => goToPage('/')}
onClick={() => goToPage(`/${currentLanguage}/`)}
>
{/* 返回首頁 */}
{t('searchMenu.text1')}
Expand All @@ -53,7 +56,7 @@ const SearchMenu = props => {
<Typography
variant="h5"
color="secondary"
onClick={() => goToPage('/district/2019')}
onClick={() => goToPage(`/${currentLanguage}/district/2019`)}
>
{/* 全港選區一覽 */}
{t('searchMenu.text2')}
Expand All @@ -64,7 +67,7 @@ const SearchMenu = props => {
<Typography
variant="h5"
color="secondary"
onClick={() => goToPage('/about-dc')}
onClick={() => goToPage(`/${currentLanguage}/about-dc`)}
>
{/* 關於區議會選舉 */}
{t('searchMenu.text3')}
Expand All @@ -75,7 +78,7 @@ const SearchMenu = props => {
<Typography
variant="h5"
color="secondary"
onClick={() => goToPage('/SelectedDistrict')}
onClick={() => goToPage(`/${currentLanguage}/SelectedDistrict`)}
>
{/* 己關注選區 */}
{t('searchMenu.text4')}
Expand All @@ -91,7 +94,6 @@ const SearchMenu = props => {
'https://docs.google.com/forms/u/1/d/e/1FAIpQLSdXtbdry3w8hkmZuN0MJaj2CP2X3RUUnCTWLnOujsfx1pHDrw/viewform?usp=send_form')
}
>
{/* TODO: i18n */}
{/* 反映意見 */}
{t('searchMenu.feedback')}
</Typography>
Expand All @@ -101,7 +103,7 @@ const SearchMenu = props => {
<Typography
variant="h5"
color="primary"
onClick={() => goToPage('/about-us')}
onClick={() => goToPage(`/${currentLanguage}/about-us`)}
>
{/* 我們是誰? */}
{t('about.support_us')}
Expand Down
2 changes: 1 addition & 1 deletion web/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import translationZH from 'locales/zh/translation.json'

i18n.use(initReactI18next).init({
fallbackLng: 'zh',
debug: true,
debug: false,
interpolation: {
escapeValue: false,
},
Expand Down