Files
FixIt/i18n/zh-CN.toml
T
Cell 14a965f9c1 refactor(assets): migrate JavaScript to TypeScript service architecture (#766)
* refactor: add TypeScript support and refactor utility functions

* docs: add CLAUDE.md for Claude Code guidance

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* refactor(assets): replace factory-function pattern with service classes and DI container

Introduce typed service container, event bus, and service interfaces to replace
the shared FixItContext factory-function pattern. Each module is now a standalone
class implementing a typed interface, with explicit constructor-injected
dependencies. The window.fixit backward-compatibility facade is built via a
publicAPI() helper that extracts class methods.

Also removes unnecessary setTimeout/afterPaint deferred execution wrappers
from init sequences, and improves module header comments.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* refactor: replace private properties with class fields in modules

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* refactor(assets): rewrite link page script in TypeScript

Rename pages/link.js to link.ts with proper type annotations and update
the Hugo template reference accordingly.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* docs: rewrite CLAUDE.md and copilot-instructions.md in English

Update both files to reflect the new service-class architecture with
DI container, typed event bus, and ES6 # private fields.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix: update event handling to use CustomEvent for better type safety

* refactor: enhance theme switching by adding isChanged flag to event details

* refactor(assets): refactor Mermaid module structure and event wiring

* refactor(assets): align lib integrations with TypedEventBus and add module overviews

* chore(assets): remove vite-specific import ignore comments

* refactor(assets): remove deprecated forEach utility and use native forEach

Replace custom forEach wrapper with native .forEach() on NodeList, HTMLCollection (via querySelectorAll), and arrays. The utility was already marked @deprecated and all 30+ call sites use synchronous handlers, making the wrapper unnecessary. Also replace getElementsByClassName/getElementsByTagName with querySelectorAll for consistency.

- Delete utils/array.ts (no longer needed)
- Remove forEach export from utils/index.ts
- Refactor 11 module files to use native .forEach()
- Switch getElementsByClassName to querySelectorAll in theme.ts and charts.ts

* refactor(assets): split ChartsModule into independent lib files

Move ECharts, Mapbox GL, and TypeIt integrations from the ServiceContainer-managed ChartsModule into three standalone lib files (echarts.ts, mapbox.ts, typeit.ts). Each lib:
- Instantiates its own TypedEventBus
- Reads config from window.config.*
- Self-initializes on DOMContentLoaded
- Handles decrypt/re-init events independently
- Uses implicit idempotency via DOM element queries

Key improvements:
- Reduces ServiceContainer complexity
- Makes chart libs independently loadable
- Fixes partial decryption handling in echarts (only re-inits decrypted portion)
- Maintains consistency with aplayer/file-tree lib pattern

* refactor(assets): extract third-party libraries to standalone lib files

Extract twemoji, pangu, cookieconsent, watermark, lightgallery, and json-viewer
from modules into separate lib files for better separation of concerns. Each lib
is loaded conditionally via assets.html and handles its own initialization and
event lifecycle independently.

Additionally, unify fixit event handling by replacing document.addEventListener
calls with TypedEventBus.on() in EncryptionModule and MiscModule for consistent
event architecture.

Remove unused MiscService dependency from ContentModule.

* refactor(assets): unify js.Build pipeline and defaults

- extract shared helper partial function/js-build.html for js.Build + minify

- make plugin script renderer and Mermaid use the same js.Build logic

- default Build.minify to hugo.IsProduction when unset

- default Build.sourceMap to cond hugo.IsDevelopment "linked" "none"

- remove duplicated sourceMap branching in layout templates

- update js targetPath naming to .js (no explicit .min.js suffix)

* refactor(assets): extract comment systems to independent lib files

Extract comment system initialization logic from CommentModule into 7 independent
lib files (artalk, gitalk, valine, waline, utterances, twikoo, giscus). Each lib:
- Conditionally loads based on window.config.comment configuration
- Handles backend-specific initialization via DOMContentLoaded
- Manages its own theme synchronization and event listeners
- Is loaded conditionally in assets.html only when enabled

Simplify CommentModule to handle only:
- Comment section UI display and visibility toggle
- Shared lightGallery initialization utility (used by Artalk and Twikoo)
- Comment expiration handling

This reduces module complexity and enables per-backend lazy loading.

* refactor(assets): unify js.Build pipeline and consolidate PWA config

Enhance js-build.html to accept Build as bool/dict, auto-derive
targetPath from resource name (.ts → .js), and skip js.Build when
Build is false/omit. Simplify assets.html by removing explicit
targetPath dicts for all .ts lib builds. Consolidate enablePWA and
serviceWorkerURL into a PWA config object.

* refactor(assets): decouple toc from content module and add JSDoc headers

- Remove TocService dependency from ContentModule, toc now self-manages
- Rename initContent() → setup(), init() → setup() for toc
- Make initFootnotes private (#initFootnotes)
- Add multi-line JSDoc headers with Responsibilities to all modules,
  main.ts, pages/link.ts, and head/color-scheme.ts

* refactor(assets): split types.ts into types/ directory module

* refactor(assets): simplify JS module architecture and expose typed window.fixit API

- Remove DI container (core/container.ts), use direct constructor calls
- Export shared eventBus singleton from core/event-bus.ts, remove 16 redundant instances
- Merge thin modules: SvgModule/CommentModule/LinkGuardModule into ContentModule/MiscModule
- Trim service interfaces to externally-used methods only
- Replace publicAPI() reflection with minimal typed window.fixit facade
- Expose public APIs: setThemeMode, eventBus, initContent, mask overlay, scroll state
- Extract setThemeMode from initSwitchTheme closure as public method
- Rename fixit:reset to fixit:re-encrypt, remove dead events
- Replace custom.js.example with custom.ts.example
- Update CLAUDE.md and copilot-instructions.md

* style(i18n): use semantic names for comment dividers instead of file paths

Replace file-path-based comment dividers (e.g. partials/base/header.html)
with semantic names (e.g. Header) across all 16 i18n files for consistency.

* chore(workflow): update cron schedule for library updates

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 12:43:42 +08:00

250 lines
5.9 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Translations for Simplified Chinese
# 简体中文的翻译
# https://gohugo.io/content-management/multilingual/#translation-of-strings
# === Init ===
[init]
hugoVersionError = "Hugo 版本过低。\n\n目前使用的 Hugo 版本为 {{ .Current }}FixIt 支持的最低的 Hugo 版本为 {{ .Minimal }}。\n\n如果你正在自己的计算机上运行 Hugo,请访问 https://gohugo.io/getting-started/installing/#upgrade-hugo 以查阅升级指南。\n\n如果你正在第三方平台上部署,请按照相应文档配置 Hugo 版本。"
hugoExtendedWarn = "需要使用 Hugo Extended 版本来获得 SCSS 支持。"
configurationError = "配置文件错误\n你还没有正确配置 FixIt 的版本参数。参考 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration"
compatibilityError = "兼容性错误 ({{ .From }} -> {{ .To }}):\n你进行了一次不兼容的更新。参考 https://github.com/hugo-fixit/FixIt/releases"
devVersionWarn = "你正在使用开发版的 FixIt,请考虑使用稳定版。\n见 https://github.com/hugo-fixit/FixIt/releases"
devEnvWarn = "当前运行环境是“development”。“评论系统”、“PWA”、“CDN”、“fingerprint”和“统计”不会启用。"
quicklyUpgrade = "使用命令快速升级:"
# === Init ===
# === Base Layout ===
[baseof]
backToTop = "回到顶部"
viewComments = "查看评论"
noscript = "该网站在启用 JavaScript 的情况下效果最佳。"
# === Base Layout ===
# === Taxonomy ===
[archives]
other = "归档"
[allSome]
other = "所有{{ .Some }}"
[category]
other = "分类"
[categories]
other = "分类"
[collection]
other = "合集"
[collections]
other = "合集"
[tag]
other = "标签"
[tags]
other = "标签"
[posts]
other = "文章"
# === Taxonomy ===
# === Section ===
[section]
recentlyUpdated = "最近更新"
[section.totalWordCount]
other = "总计约 {{ .Count }} 字"
[section.archiveCounter]
other = "共计 {{ .Count }} 篇文章"
# === Section ===
# === Pagination ===
[pagination]
more = "更多"
# === Pagination ===
# === Header ===
[header]
selectLanguage = "选择语言"
noMoretTranslations = "没有更多翻译"
switchTheme = "切换主题"
# === Header ===
# === Footer ===
[footer]
poweredBySome = "由 {{ .Hugo }} 强力驱动 | 主题 - {{ .Theme }}"
siteUV = "总访客数"
sitePV = "总访问量"
siteRunning = "网站运行中……"
# === Footer ===
# === Comment ===
[comment]
valineLang = "zh-cn"
valinePlaceholder = "你的评论……"
facebookLanguageCode = "zh_CN"
# === Comment ===
# === Assets ===
[assets]
search = "搜索"
searchPlaceholder = "搜索文章标题或内容……"
searchIn = "在 {{ . }} 中搜索"
gotoResultsPage = "前往搜索结果页面……"
clear = "清空"
cancel = "取消"
noResultsFound = "没有找到结果"
copyToClipboard = "复制到剪贴板"
copyText = "复制"
copiedText = "已复制"
toggleLineNumbers = "切换行号"
toggleLineWrap = "切换自动换行"
toggleCodeEditable = "切换可编辑代码块"
downloadCode = "下载代码"
expandCode = "展开或折叠代码块"
fullscreen = "全屏"
exitFullscreen = "退出全屏"
cookieconsentMessage = "本网站使用 Cookies 来改善你的浏览体验。"
cookieconsentDismiss = "同意"
cookieconsentLink = "了解更多"
# === Assets ===
# === Share ===
[shareOn]
other = "分享到"
# === Share ===
# === Single Post ===
[single]
contents = "目录"
pin = "置顶"
repost = "转载"
publishedOnDate = "发布于 {{ .Date }}"
views = "次阅读"
comments = "条评论"
author = "作者"
updatedOnDate = "更新于 {{ .Date }}"
readMarkdown = "阅读原始文档"
viewSource = "查看源码"
editThisPage = "编辑此页"
reportIssue = "报告问题"
openInEditor = "在编辑器中打开"
back = "返回"
home = "主页"
readMore = "阅读全文"
expirationReminder = "本文最后更新于 {{ .Date }},文中内容可能已过时。"
encryptedAbstract = "本文已加密,因此其原始内容不可见!"
encryptedMessage = "请输入密码"
password = "密码"
enterBtn = "进入"
encryptyAgain = "重新加密"
relatedContent = "相关内容"
[single.includedIn]
categories = "收录于 {{ .Categories }}"
collections = "收录于 {{ .Collections }}"
both = "收录于 {{ .Categories }} 和 {{ .Collections }}"
[single.wordCount]
other = "{{ .Count }} 字"
[single.fuzzyWordCount]
other = "约 {{ .Count }} 字"
[single.readingTime]
other = "预计阅读 {{ .Count }} 分钟"
[single.reward]
donate = "赞赏"
wechatpay = "微信"
alipay = "支付宝"
paypal = "贝宝"
bitcoin = "比特币"
# === Single Post ===
# === Error Pages ===
[pageNotFound]
other = "页面没找到"
[pageNotFoundText]
other = "抱歉,你要查找的页面不存在。"
# === Error Pages ===
# === Offline ===
[offlineTitle]
other = "离线"
[offlineText]
other = "你没有连接到 Internet,只有缓存的页面可用。"
# === Offline ===
# === Link Redirection ===
[linkRedirection]
title = "跳转提示"
message = "即将离开{{ .Title }},请注意账号财产安全。"
confirm = "继续访问"
# === Link Redirection ===
# === Alert ===
[alert]
note = "注意"
tip = "提示"
important = "重要"
warning = "警告"
caution = "小心"
# === Alert ===
# === Task List ===
[taskList]
x = "已完成"
" " = "未完成"
"/" = "进行中"
"-" = "已取消"
"<" = "已计划"
">" = "已重新计划"
"!" = "重要"
"!x" = "重要已核验"
"?" = "问题"
# === Task List ===
# === Admonition ===
[admonition]
note = "注意"
abstract = "摘要"
info = "信息"
todo = "待办"
tip = "技巧"
success = "成功"
question = "问题"
warning = "警告"
failure = "失败"
danger = "危险"
bug = "Bug"
example = "示例"
quote = "引用"
# === Admonition ===
# === Version ===
[version]
new = "新增"
changed = "更改"
deleted = "删除"
deprecated = "弃用"
# === Version ===
# === Diagram ===
[diagram]
zoomIn = "放大"
zoomOut = "缩小"
reset = "重置"
download = "下载 SVG"
# === Diagram ===
# === Tabs ===
[tabs]
diagram = "图表"
code = "代码"
# === Tabs ===