From 087612e9d7e6dcc17ab99733d87237627092e175 Mon Sep 17 00:00:00 2001 From: MH Hung Date: Wed, 17 Sep 2025 10:11:58 +0800 Subject: [PATCH] chore: localize theme wording for zh-TW --- mhhung/components/ArticleAround.js | 2 +- mhhung/components/ArticleInfo.js | 4 ++-- mhhung/components/ArticleLock.js | 10 ++++---- mhhung/components/BlogArchiveItem.js | 2 +- mhhung/components/BlogItem.js | 8 +++---- mhhung/components/BlogListPage.js | 4 ++-- mhhung/components/BlogListScroll.js | 4 ++-- mhhung/components/BlogPostBar.js | 2 +- mhhung/components/Catalog.js | 34 +++++++++++++-------------- mhhung/components/JumpToTopButton.js | 8 +++---- mhhung/components/MenuItemCollapse.js | 4 ++-- mhhung/components/MenuItemDrop.js | 2 +- mhhung/components/MenuList.js | 8 +++---- mhhung/components/NavBar.js | 2 +- mhhung/components/RecommendPosts.js | 2 +- mhhung/components/SocialButton.js | 2 +- mhhung/components/Title.js | 2 +- mhhung/components/TopBar.js | 2 +- mhhung/config.js | 16 ++++++------- mhhung/layouts/NotFoundLayout.jsx | 2 +- mhhung/style.js | 6 ++--- 21 files changed, 63 insertions(+), 63 deletions(-) diff --git a/mhhung/components/ArticleAround.js b/mhhung/components/ArticleAround.js index a2f9c7d..c3d2653 100644 --- a/mhhung/components/ArticleAround.js +++ b/mhhung/components/ArticleAround.js @@ -1,7 +1,7 @@ import SmartLink from '@/components/SmartLink' /** - * 上一篇,下一篇文章 + * 上一則與下一則文章 * @param {prev,next} param0 * @returns */ diff --git a/mhhung/components/ArticleInfo.js b/mhhung/components/ArticleInfo.js index 0065500..8175aa0 100644 --- a/mhhung/components/ArticleInfo.js +++ b/mhhung/components/ArticleInfo.js @@ -6,7 +6,7 @@ import { formatDateFmt } from '@/lib/utils/formatDate' import NotionIcon from '@/components/NotionIcon' /** - * 文章描述 + * 文章說明 * @param {*} props * @returns */ @@ -27,7 +27,7 @@ export default function ArticleInfo(props) {
- 发布于 + 發佈於 diff --git a/mhhung/components/ArticleLock.js b/mhhung/components/ArticleLock.js index d9f6e97..3a47720 100644 --- a/mhhung/components/ArticleLock.js +++ b/mhhung/components/ArticleLock.js @@ -2,10 +2,10 @@ import { useGlobal } from '@/lib/global' import { useEffect, useRef } from 'react' /** - * 加密文章校验组件 + * 加密文章驗證元件 * @param {password, validPassword} props - * @param password 正确的密码 - * @param validPassword(bool) 回调函数,校验正确回调入参为true + * @param password 正確的密碼 + * @param validPassword(bool) 回呼函式,驗證正確回呼參數為 true * @returns */ export default function ArticleLock (props) { @@ -24,7 +24,7 @@ export default function ArticleLock (props) { } const passwordInputRef = useRef(null) useEffect(() => { - // 选中密码输入框并将其聚焦 + // 選中密碼輸入框並將其聚焦 passwordInputRef.current.focus() }, []) @@ -38,7 +38,7 @@ export default function ArticleLock (props) { submitPassword() } }} - ref={passwordInputRef} // 绑定ref到passwordInputRef变量 + ref={passwordInputRef} // 綁定 ref 到 passwordInputRef 變數 className='outline-none w-full text-sm pl-5 rounded-l transition focus:shadow-lg font-light leading-10 text-black dark:bg-gray-500 bg-gray-50' >
diff --git a/mhhung/components/BlogArchiveItem.js b/mhhung/components/BlogArchiveItem.js index 28bab81..b3d547d 100644 --- a/mhhung/components/BlogArchiveItem.js +++ b/mhhung/components/BlogArchiveItem.js @@ -1,7 +1,7 @@ import SmartLink from '@/components/SmartLink' /** - * 归档分组文章 + * 歸檔文章清單 * @param {*} param0 * @returns */ diff --git a/mhhung/components/BlogItem.js b/mhhung/components/BlogItem.js index be2ac0e..b51a4ff 100644 --- a/mhhung/components/BlogItem.js +++ b/mhhung/components/BlogItem.js @@ -16,11 +16,11 @@ export const BlogItem = props => { siteConfig('POST_LIST_PREVIEW', false, NOTION_CONFIG) && post.blockMap return (
- {/* 文章标题 */} + {/* 文章標題 */}
- {/* 图片封面 */} + {/* 圖片封面 */} {showPageCover && (
@@ -45,11 +45,11 @@ export const BlogItem = props => { - {/* 文章信息 */} + {/* 文章資訊 */}
- 发布于 + 發佈於 diff --git a/mhhung/components/BlogListPage.js b/mhhung/components/BlogListPage.js index 333bbb8..ecb92e4 100644 --- a/mhhung/components/BlogListPage.js +++ b/mhhung/components/BlogListPage.js @@ -7,7 +7,7 @@ import CONFIG from '../config' import { BlogItem } from './BlogItem' /** - * 博客列表 + * 部落格文章列表 * @param {*} props * @returns */ @@ -19,7 +19,7 @@ export default function BlogListPage(props) { const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const currentPage = +page - // 博客列表嵌入广告 + // 部落格列表插入廣告 const TYPOGRAPHY_POST_AD_ENABLE = siteConfig( 'TYPOGRAPHY_POST_AD_ENABLE', false, diff --git a/mhhung/components/BlogListScroll.js b/mhhung/components/BlogListScroll.js index 2252a99..710e68b 100644 --- a/mhhung/components/BlogListScroll.js +++ b/mhhung/components/BlogListScroll.js @@ -5,7 +5,7 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { BlogItem } from './BlogItem' /** - * 滚动博客列表 + * 捲動部落格列表 * @param {*} props * @returns */ @@ -30,7 +30,7 @@ export default function BlogListScroll(props) { const targetRef = useRef(null) - // 监听滚动自动分页加载 + // 監聽滾動自動分頁載入 const scrollTrigger = useCallback( throttle(() => { const scrollS = window.scrollY + window.outerHeight diff --git a/mhhung/components/BlogPostBar.js b/mhhung/components/BlogPostBar.js index 9efac11..53ce417 100644 --- a/mhhung/components/BlogPostBar.js +++ b/mhhung/components/BlogPostBar.js @@ -1,7 +1,7 @@ import { useGlobal } from '@/lib/global' /** - * 文章列表上方嵌入 + * 文章列表上方區塊 * @param {*} props * @returns */ diff --git a/mhhung/components/Catalog.js b/mhhung/components/Catalog.js index e92e586..5149bc4 100644 --- a/mhhung/components/Catalog.js +++ b/mhhung/components/Catalog.js @@ -4,26 +4,26 @@ import { uuidToId } from 'notion-utils' import { useEffect, useRef, useState } from 'react' /** - * 目录导航组件 + * 目錄導覽元件 * @param toc * @returns {JSX.Element} * @constructor */ const Catalog = ({ post }) => { const { locale } = useGlobal() - // 目录自动滚动 + // 目錄自動滾動 const tRef = useRef(null) - // 同步选中目录事件 + // 同步選中目錄事件 const [activeSection, setActiveSection] = useState(null) - // 监听滚动事件 + // 監聽滾動事件 useEffect(() => { - // 如果没有文章或目录,不执行任何操作 + // 如果沒有文章或目錄,不執行任何操作 if (!post || !post?.toc || post?.toc?.length < 1) { return } - const throttleMs = 100 // 降低节流时间提高响应速度 + const throttleMs = 100 // 降低節流時間提高響應速度 const actionSectionScrollSpy = throttle(() => { const sections = document.getElementsByClassName('notion-h') @@ -32,34 +32,34 @@ const Catalog = ({ post }) => { let prevBBox = null let currentSectionId = null - // 先检查当前视口中的所有标题 + // 先檢查當前視窗中的所有標題 for (let i = 0; i < sections.length; ++i) { const section = sections[i] if (!section || !(section instanceof Element)) continue const bbox = section.getBoundingClientRect() - const offset = 100 // 固定偏移量,避免计算不稳定 + const offset = 100 // 固定位移量,避免計算不穩定 - // 如果标题在视口上方或接近顶部,认为是当前标题 + // 如果標題在視窗上方或接近頂部,認為是當前標題 if (bbox.top - offset < 0) { currentSectionId = section.getAttribute('data-id') prevBBox = bbox } else { - // 找到第一个在视口下方的标题就停止 + // 找到第一個在視窗下方的標題就停止 break } } - // 如果没找到任何标题在视口上方,使用第一个标题 + // 如果沒找到任何標題在視窗上方,使用第一個標題 if (!currentSectionId && sections.length > 0) { currentSectionId = sections[0].getAttribute('data-id') } - // 只有当 ID 变化时才更新状态,减少不必要的渲染 + // 只有當 ID 變化時才更新狀態,減少不必要的渲染 if (currentSectionId !== activeSection) { setActiveSection(currentSectionId) - // 查找目录中对应的索引并滚动 + // 查找目錄中對應的索引並滾動 const index = post?.toc?.findIndex( obj => uuidToId(obj.id) === currentSectionId ) @@ -73,20 +73,20 @@ const Catalog = ({ post }) => { const content = document.querySelector('#container-inner') if (!content) return // 防止 content 不存在 - // 添加滚动和内容变化的监听 + // 添加滾動和內容變化的監聽 content.addEventListener('scroll', actionSectionScrollSpy) - // 初始执行一次 + // 初始執行一次 setTimeout(() => { actionSectionScrollSpy() - }, 300) // 延迟执行确保 DOM 已完全加载 + }, 300) // 延遲執行確保 DOM 已完全載入 return () => { content?.removeEventListener('scroll', actionSectionScrollSpy) } }, [post]) - // 无目录就直接返回空 + // 無目錄就直接返回空 if (!post || !post?.toc || post?.toc?.length < 1) { return <> } diff --git a/mhhung/components/JumpToTopButton.js b/mhhung/components/JumpToTopButton.js index 358c937..00ec74b 100644 --- a/mhhung/components/JumpToTopButton.js +++ b/mhhung/components/JumpToTopButton.js @@ -2,10 +2,10 @@ import { useGlobal } from '@/lib/global' import { useEffect, useState } from 'react' /** - * 跳转到网页顶部 - * 当屏幕下滑500像素后会出现该控件 - * @param targetRef 关联高度的目标html标签 - * @param showPercent 是否显示百分比 + * 跳轉到網頁頂部 + * 當畫面下滑 500 像素後會出現此按鈕 + * @param targetRef 連結高度的目標 html 元素 + * @param showPercent 是否顯示百分比 * @returns {JSX.Element} * @constructor */ diff --git a/mhhung/components/MenuItemCollapse.js b/mhhung/components/MenuItemCollapse.js index 9de40a7..de470a0 100644 --- a/mhhung/components/MenuItemCollapse.js +++ b/mhhung/components/MenuItemCollapse.js @@ -3,7 +3,7 @@ import SmartLink from '@/components/SmartLink' import { useState } from 'react' /** - * 折叠菜单 + * 收合選單 * @param {*} param0 * @returns */ @@ -64,7 +64,7 @@ export const MenuItemCollapse = props => { )}
- {/* 折叠子菜单 */} + {/* 收合子選單 */} {hasSubMenu && ( {link.subMenus.map((sLink, index) => { diff --git a/mhhung/components/MenuItemDrop.js b/mhhung/components/MenuItemDrop.js index fa718f1..6aaca96 100644 --- a/mhhung/components/MenuItemDrop.js +++ b/mhhung/components/MenuItemDrop.js @@ -49,7 +49,7 @@ export const MenuItemDrop = ({ link }) => { )}
- {/* 子菜單 */} + {/* 子選單 */}
    {link?.subMenus?.map((sLink, index) => { diff --git a/mhhung/components/MenuList.js b/mhhung/components/MenuList.js index 8eb458d..0b04791 100644 --- a/mhhung/components/MenuList.js +++ b/mhhung/components/MenuList.js @@ -8,7 +8,7 @@ import { MenuItemCollapse } from './MenuItemCollapse' import { MenuItemDrop } from './MenuItemDrop' /** - * 菜单导航 + * 選單導覽 * @param {*} props * @returns */ @@ -53,7 +53,7 @@ export const MenuList = ({ customNav, customMenu }) => { links = links.concat(customNav) } - // 如果 开启自定义菜单,则覆盖 Page 生成的菜单 + // 如果 開啟自訂選單,則覆蓋 Page 生成的選單 if (siteConfig('CUSTOM_MENU')) { links = customMenu } @@ -64,13 +64,13 @@ export const MenuList = ({ customNav, customMenu }) => { return ( <> - {/* 大屏模式菜单 - 垂直排列 */} + {/* 大螢幕模式選單 - 垂直排列 */} - {/* 移动端小屏菜单 - 水平排列 */} + {/* 行動端小螢幕選單 - 水平排列 */}