summaryrefslogtreecommitdiff
path: root/src/components/SideBar.tsx
diff options
context:
space:
mode:
authorHaishan <[email protected]>2020-12-06 14:57:59 +0800
committerHaishan <[email protected]>2020-12-06 20:19:51 +0800
commit8a50ef4ef2f6f6044d36ea2f4fe06e663083972e (patch)
treeda098c1434b5f745f391330dde37b6468deec45b /src/components/SideBar.tsx
parenta8c6cd23ce2b585362f515080b2167990c554fed (diff)
feat: initial Chinese UI language support
Diffstat (limited to 'src/components/SideBar.tsx')
-rw-r--r--src/components/SideBar.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx
index 6cfd829..973f003 100644
--- a/src/components/SideBar.tsx
+++ b/src/components/SideBar.tsx
@@ -2,6 +2,7 @@ import Tooltip from '@reach/tooltip';
import cx from 'clsx';
import * as React from 'react';
import { Info } from 'react-feather';
+import { useTranslation } from 'react-i18next';
import {
FcAreaChart,
FcDocument,
@@ -85,6 +86,7 @@ const pages = [
];
function SideBar({ dispatch, theme }) {
+ const { t } = useTranslation();
const location = useLocation();
const switchThemeHooked = useCallback(() => {
dispatch(switchTheme());
@@ -99,13 +101,13 @@ function SideBar({ dispatch, theme }) {
to={to}
isActive={location.pathname === to}
iconId={iconId}
- labelText={labelText}
+ labelText={t(labelText)}
/>
))}
</div>
<div className={s.footer}>
<Tooltip
- label="theme"
+ label={t('theme')}
aria-label={
'switch to ' + (theme === 'light' ? 'dark' : 'light') + ' theme'
}
@@ -117,7 +119,7 @@ function SideBar({ dispatch, theme }) {
{theme === 'light' ? <MoonA /> : <Sun />}
</button>
</Tooltip>
- <Tooltip label="about">
+ <Tooltip label={t('about')}>
<Link to="/about" className={s.iconWrapper}>
<Info size={20} />
</Link>