feat: 支持繁体中文和日语国际化

This commit is contained in:
digua
2026-03-11 22:07:59 +08:00
committed by digua
parent e7f2ee7db7
commit a633b4f326
62 changed files with 5470 additions and 79 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
# 同步当前仓库 changelog 到 ../chatlab.fun 并提交 docs: changelogs update
# 同步当前仓库多语言 changelog 到 ../chatlab.fun 并提交 docs: changelogs update
# 用法sync_to_chatlab_fun.sh <source_repo> <target_repo>
SOURCE_REPO="${1:-}"
TARGET_REPO="${2:-}"
@@ -13,25 +13,35 @@ fi
SRC_CN="$SOURCE_REPO/docs/changelogs_cn.json"
SRC_EN="$SOURCE_REPO/docs/changelogs_en.json"
SRC_TW="$SOURCE_REPO/docs/changelogs_tw.json"
SRC_JA="$SOURCE_REPO/docs/changelogs_ja.json"
DST_CN="$TARGET_REPO/docs/public/cn/changelogs.json"
DST_EN="$TARGET_REPO/docs/public/en/changelogs.json"
DST_TW="$TARGET_REPO/docs/public/tw/changelogs.json"
DST_JA="$TARGET_REPO/docs/public/ja/changelogs.json"
# 目标文件必须预先存在,不允许自动创建。
if [[ ! -f "$DST_CN" || ! -f "$DST_EN" ]]; then
if [[ ! -f "$DST_CN" || ! -f "$DST_EN" || ! -f "$DST_TW" || ! -f "$DST_JA" ]]; then
echo "错误: chatlab.fun 目标 changelog 文件不存在,请先手动准备" >&2
exit 1
fi
if [[ ! -f "$SRC_CN" || ! -f "$SRC_EN" ]]; then
if [[ ! -f "$SRC_CN" || ! -f "$SRC_EN" || ! -f "$SRC_TW" || ! -f "$SRC_JA" ]]; then
echo "错误: 源仓库 changelog 文件不存在" >&2
exit 1
fi
cp "$SRC_CN" "$DST_CN"
cp "$SRC_EN" "$DST_EN"
cp "$SRC_TW" "$DST_TW"
cp "$SRC_JA" "$DST_JA"
# 仅提交目标文档文件,避免提交其他改动。
git -C "$TARGET_REPO" add docs/public/cn/changelogs.json docs/public/en/changelogs.json
git -C "$TARGET_REPO" add \
docs/public/cn/changelogs.json \
docs/public/en/changelogs.json \
docs/public/tw/changelogs.json \
docs/public/ja/changelogs.json
if git -C "$TARGET_REPO" diff --cached --quiet; then
echo "错误: chatlab.fun 没有可提交的 changelog 变更" >&2