diff --git a/blog.config.js b/blog.config.js index ba52c635..2b8432be 100644 --- a/blog.config.js +++ b/blog.config.js @@ -4,7 +4,7 @@ const BLOG = { email: 'tlyong1992@hotmail.com', link: 'https://tangly1024.com', description: '分享有趣的技术与思考', - lang: 'zh-CN', // ['zh-CN','en-US'] + lang: 'zh-CN', // ['zh-CN','en-US'] default lang => see /lib/lang.js for more. notionPageId: process.env.NOTION_PAGE_ID || 'bee1fccfa3bd47a1a7be83cc71372d83', // Important page_id!!! notionAccessToken: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public defaultImgCover: 'https://avatars.githubusercontent.com/u/15920488', // default image cover diff --git a/components/CategoryGroup.js b/components/CategoryGroup.js index 3acb7ec7..0b20eddc 100644 --- a/components/CategoryGroup.js +++ b/components/CategoryGroup.js @@ -2,12 +2,7 @@ import Link from 'next/link' import React from 'react' const CategoryGroup = ({ currentCategory, categories }) => { - return <> -
-
文章分类
-
-
+ return
{Object.keys(categories).map(category => { return @@ -16,7 +11,6 @@ const CategoryGroup = ({ currentCategory, categories }) => { })}
- } export default CategoryGroup diff --git a/components/LatestPosts.js b/components/LatestPosts.js index 20a5e9a4..ac8e94b9 100644 --- a/components/LatestPosts.js +++ b/components/LatestPosts.js @@ -2,6 +2,7 @@ import Link from 'next/link' import BLOG from '@/blog.config' import { formatDateFmt } from '@/lib/formatDate' import { useRouter } from 'next/router' +import { useGlobal } from '@/lib/global' /** * 最新文章列表 @@ -24,11 +25,12 @@ const LatestPosts = ({ posts }) => { // 获取当前路径 const currentPath = useRouter().asPath + const { locale } = useGlobal() return <>
-
最近更新
+
{locale.COMMON.LATEST_POSTS}
{postsSortByDate.map(post => { diff --git a/components/ShareBar.js b/components/ShareBar.js index 215646dc..775520bd 100644 --- a/components/ShareBar.js +++ b/components/ShareBar.js @@ -4,6 +4,7 @@ import React from 'react' import { createPopper } from '@popperjs/core' import copy from 'copy-to-clipboard' import QRCode from 'qrcode.react' +import { useGlobal } from '@/lib/global' const ShareBar = ({ post }) => { const router = useRouter() @@ -13,6 +14,7 @@ const ShareBar = ({ post }) => { const [qrCodeShow, setQrCodeShow] = React.useState(false) const btnRef = React.createRef() const popoverRef = React.createRef() + const { locale } = useGlobal() const openPopover = () => { createPopper(btnRef.current, popoverRef.current, { @@ -26,13 +28,13 @@ const ShareBar = ({ post }) => { const copyUrl = () => { copy(shareUrl) - alert('当前链接已复制到剪贴板') + alert(locale.COMMON.URL_COPIED) } return <>
-
分享本文:
+
{locale.COMMON.SHARE}:
@@ -61,7 +63,7 @@ const ShareBar = ({ post }) => { />
- 扫一扫分享 + {locale.COMMON.SCAN_QR_CODE}
diff --git a/components/SideBar.js b/components/SideBar.js index 0e89154b..78885bcb 100644 --- a/components/SideBar.js +++ b/components/SideBar.js @@ -7,6 +7,7 @@ import CategoryGroup from '@/components/CategoryGroup' import Toc from '@/components/Toc' import SearchInput from '@/components/SearchInput' import Link from 'next/link' +import { useGlobal } from '@/lib/global' /** * 侧边栏 @@ -21,6 +22,7 @@ import Link from 'next/link' * @constructor */ const SideBar = ({ tags, currentTag, post, posts, categories, currentCategory, currentSearch }) => { + const { locale } = useGlobal() return