From c124e3e6fc18f977e584fe0d29b3061e5039c5c0 Mon Sep 17 00:00:00 2001 From: wingkwong Date: Fri, 15 Nov 2019 22:20:18 +0800 Subject: [PATCH 1/2] Link with Lang --- web/src/components/organisms/SearchMenu.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/web/src/components/organisms/SearchMenu.js b/web/src/components/organisms/SearchMenu.js index 9006b19c..0fa299b9 100644 --- a/web/src/components/organisms/SearchMenu.js +++ b/web/src/components/organisms/SearchMenu.js @@ -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)` && { @@ -36,13 +37,15 @@ const SearchMenu = props => { dispatch({ type: DRAWER_CLOSE }) } + const currentLanguage = getCurrentLanguage() + return ( <> goToPage('/')} + onClick={() => goToPage(`/${currentLanguage}/`)} > {/* 返回首頁 */} {t('searchMenu.text1')} @@ -53,7 +56,7 @@ const SearchMenu = props => { goToPage('/district/2019')} + onClick={() => goToPage(`/${currentLanguage}/district/2019`)} > {/* 全港選區一覽 */} {t('searchMenu.text2')} @@ -64,7 +67,7 @@ const SearchMenu = props => { goToPage('/about-dc')} + onClick={() => goToPage(`/${currentLanguage}/about-dc`)} > {/* 關於區議會選舉 */} {t('searchMenu.text3')} @@ -75,7 +78,7 @@ const SearchMenu = props => { goToPage('/SelectedDistrict')} + onClick={() => goToPage(`/${currentLanguage}/SelectedDistrict`)} > {/* 己關注選區 */} {t('searchMenu.text4')} @@ -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')} @@ -101,7 +103,7 @@ const SearchMenu = props => { goToPage('/about-us')} + onClick={() => goToPage(`/${currentLanguage}/about-us`)} > {/* 我們是誰? */} {t('about.support_us')} From 5a7ef3855ccc63e0a23e207c93d9da164d2d9712 Mon Sep 17 00:00:00 2001 From: wingkwong Date: Fri, 15 Nov 2019 22:20:45 +0800 Subject: [PATCH 2/2] Disable debug --- web/src/i18n.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/i18n.js b/web/src/i18n.js index abc501a4..aa8b3ade 100644 --- a/web/src/i18n.js +++ b/web/src/i18n.js @@ -5,7 +5,7 @@ import translationZH from 'locales/zh/translation.json' i18n.use(initReactI18next).init({ fallbackLng: 'zh', - debug: true, + debug: false, interpolation: { escapeValue: false, },