修复: 中文 i18n 目录名从 zh-Hans 改为 zh-CN,首页 SSR 翻译现已生效 (#42)

Docusaurus 3.10 会把 locale id 'zh-Hans' 规范化为 BCP 47 的 'zh-CN' 来
读取 i18n/ 目录。之前手工创建的 i18n/zh-Hans/ 目录 Docusaurus 识别不到,
导致中文版 SSR 输出仍是英文字符串,只有 URL 路由 /zh-Hans/ 生效。

同时修复 index.tsx 中 <Translate id={labelId}> 动态 id 问题:
write-translations 工具要求静态字符串,已拆分为三个独立的 Translate 元素。
This commit is contained in:
Wu Qing
2026-04-17 13:52:16 +08:00
committed by GitHub
parent c629b5f286
commit 1a0e6d463a
21 changed files with 18 additions and 18 deletions

View File

@@ -0,0 +1,41 @@
---
sidebar_position: 2
title: 贡献指南
description: 如何反馈问题、提出改进、提交 PR。
---
# 贡献指南
BackupX 使用 Apache License 2.0 开源,欢迎提交 Issue 与 Pull Request。
## 报告 Bug
在 [github.com/Awuqing/BackupX/issues](https://github.com/Awuqing/BackupX/issues) 提交 Issue请附上
- BackupX 版本(`backupx --version`
- 部署方式Docker / 裸机 / 源码)
- 相关的备份任务类型和存储后端
- 复现步骤
- 问题发生时段的 stdout / `backupx.log` 片段
## 提议改动
对于重要功能或重构,建议先开 Issue 对齐方案,避免 PR 大改动后被 Review 回退。
## 提交 PR
1. Fork 仓库,创建主题分支(如 `fix/windows-path-escape`
2. 执行 `make test` 确认本地全通过
3. 保持每个 PR 只做一件事
4. Commit message 使用中文,格式 `类型: 简要描述`
- `功能: 新增审计日志模块`
- `修复: 目录浏览器无法进入子目录`
- `重构: 简化存储目标解密逻辑`
- 类型:`功能` / `修复` / `重构` / `文档` / `构建` / `测试`
5. PR 标题和正文同样使用中文,描述"为什么"和"怎么做",而非仅仅"做了什么"
## 代码规范
- **Go** — 所有错误必须处理(禁止 `_ = err`),日志使用现有 `zap`,禁止生产路径中出现 `fmt.Println`
- **TypeScript** — 严格模式,禁止隐式 any遵循现有 ESLint/Prettier 配置
- **Commit 粒度** — 每个 commit 一件事,不要把顺手的小修改和功能代码混在一起

View File

@@ -0,0 +1,83 @@
---
sidebar_position: 1
title: 开发环境
description: 搭建 BackupX 本地开发环境 — 后端、前端、测试。
---
# 开发环境
**环境要求:** Go ≥ 1.25Node.js ≥ 20npm。
## 克隆与依赖
```bash
git clone https://github.com/Awuqing/BackupX.git && cd BackupX
cd web && npm install && cd ..
```
## 开发服务
开两个终端分别跑后端和前端:
```bash
# 终端 1后端监听 :8340
make dev-server
# 终端 2Vite HMR监听 :5173
make dev-web
```
Vite 配置了 `/api` 代理到 `http://127.0.0.1:8340`,浏览器直接访问 `http://localhost:5173`
## 测试
```bash
make test # 运行 Go + Web 全部测试
make test-server # 仅 Go
make test-web # 仅 Vitest
```
## 生产构建
```bash
make build # server/bin/backupx + web/dist
make docker # Docker 镜像
make docker-cn # 国内镜像加速构建
```
## 技术栈
| 组件 | 技术 |
|------|------|
| **后端** | Go · Gin · GORM · SQLite · robfig/cron · rclone |
| **前端** | React 18 · TypeScript · ArcoDesign · Vite · Zustand · ECharts |
| **存储** | rclone70+ 后端)· AWS SDK v2 · Google Drive API v3 |
| **安全** | JWT · bcrypt · AES-256-GCM |
## 目录结构
```
BackupX/
├── server/ # Go 后端
│ ├── cmd/backupx/ # 入口 + 子命令agent / backint / reset-password
│ ├── internal/
│ │ ├── agent/ # Agent CLI 逻辑
│ │ ├── app/ # 装配repo → service → handler
│ │ ├── backup/ # 备份 runnerfile / mysql / postgres / sqlite / saphana
│ │ ├── backint/ # SAP HANA Backint 协议
│ │ ├── http/ # HTTP handler + router
│ │ ├── model/ # GORM 模型
│ │ ├── repository/ # 数据访问
│ │ ├── service/ # 业务逻辑
│ │ └── storage/ # 存储 providerrclone + 直接 SDK
│ └── pkg/ # 通用工具
├── web/ # React 前端Vite
│ └── src/
│ ├── components/
│ ├── pages/
│ ├── services/
│ └── types/
├── docs-site/ # 文档站Docusaurus
├── deploy/ # install.sh / systemd unit / nginx config
└── Makefile
```