From 52bc9eccabf00d1c42cc4ec6b30c1432f8dddb49 Mon Sep 17 00:00:00 2001
From: marcomarcogd <35049765+marcomarcogd@users.noreply.github.com>
Date: Tue, 14 Jul 2026 13:45:11 +0800
Subject: [PATCH 1/3] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=8F=AF?=
=?UTF-8?q?=E6=89=A9=E5=B1=95=E5=A4=9A=E8=AF=AD=E8=A8=80=E5=92=8C=E7=AE=80?=
=?UTF-8?q?=E4=BD=93=E4=B8=AD=E6=96=87=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
NOTICE.md | 2 +
NOTICE.zh-CN.md | 28 +
README.md | 46 +-
README.zh-CN.md | 212 +
index.html | 403 +-
locales/en.js | 176 +
locales/manifest.js | 16 +
locales/runtime.js | 234 +
locales/zh-CN.js | 14571 ++++++++++++++++++++++++++++++++++++++++++
setup.html | 509 +-
10 files changed, 15973 insertions(+), 224 deletions(-)
create mode 100644 NOTICE.zh-CN.md
create mode 100644 README.zh-CN.md
create mode 100644 locales/en.js
create mode 100644 locales/manifest.js
create mode 100644 locales/runtime.js
create mode 100644 locales/zh-CN.js
diff --git a/NOTICE.md b/NOTICE.md
index 41985737..7a94995a 100644
--- a/NOTICE.md
+++ b/NOTICE.md
@@ -1,3 +1,5 @@
+[**English**](NOTICE.md) · [简体中文](NOTICE.zh-CN.md)
+
# Media Attribution & License
The exercise **media** (thumbnail images and animation GIFs) in this repository
diff --git a/NOTICE.zh-CN.md b/NOTICE.zh-CN.md
new file mode 100644
index 00000000..b1f2855d
--- /dev/null
+++ b/NOTICE.zh-CN.md
@@ -0,0 +1,28 @@
+[English](NOTICE.md) · **简体中文**
+
+# 媒体署名与许可说明
+
+> **译文声明:** 本文件是 `NOTICE.md` 的非官方简体中文参考译文,仅为方便阅读,不构成新的授权、许可或法律意见。若本译文与英文原文存在差异,应以英文 [`NOTICE.md`](NOTICE.md)、[`LICENSE`](LICENSE) 及权利人的原始条款为准。
+
+本仓库中的动作训练媒体文件(缩略图和 GIF 动画)归 **Gym visual** 所有,并经其许可在此重新分发。
+
+> **© Gym visual — https://gymvisual.com/**
+
+## 使用条件
+
+- **分辨率:** 仅以 **180×180** 分辨率分发。
+- **署名:** 每次使用都必须保留版权标识 **© Gym visual — https://gymvisual.com/**。每条 [`data/exercises.json`](data/exercises.json) 记录也包含此 `attribution` 声明。
+
+使用这些媒体文件时,请完整保留署名并遵守 180×180 分辨率限制。
+
+## 再利用与许可
+
+这些媒体文件依据权利人给予的单独书面许可收录于本仓库。媒体文件仍归 Gym visual 所有,其使用和再次利用受 **Gym visual 使用条款与条件**约束:
+
+> **https://gymvisual.com/content/3-terms-and-conditions-of-use**
+
+若要在自己的项目中使用这些媒体文件,请先阅读上述条款,并在需要时直接向 Gym visual 获取许可。除 Gym visual 条款允许的范围外,本仓库不会授予你额外的媒体权利;克隆本仓库不等于取得媒体许可。
+
+## 数据集(不含媒体)
+
+动作训练数据(名称、分类、身体部位、器械、目标肌肉、肌群、多语言训练说明及本地化语言包)独立于媒体文件,并根据 MIT License 发布,详见 [`LICENSE`](LICENSE)。
diff --git a/README.md b/README.md
index 8b4a238c..71c57d79 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+[**English**](README.md) · [简体中文](README.zh-CN.md)
+
# 💪 Exercises Dataset
@@ -33,6 +35,7 @@
- 1,324 exercises with category, body-part, equipment, target and muscle-group data
- an animation GIF + 180×180 thumbnail for every exercise (media © [Gym visual](https://gymvisual.com/) — see [License](#-license--use))
- step-by-step instructions in 9 languages (🇬🇧 English, 🇪🇸 Spanish, 🇮🇹 Italian, 🇹🇷 Turkish, 🇷🇺 Russian, 🇨🇳 Chinese, 🇮🇳 Hindi, 🇵🇱 Polish, 🇰🇷 Korean)
+- an extensible browser localization system with complete Simplified Chinese exercise names, taxonomy, and reviewed instructions in a single locale pack
- the interactive browser (`index.html`) and developer setup guide (`setup.html`)
---
@@ -42,6 +45,7 @@
- [Data Source](#-data-source)
- [Overview](#-overview)
- [Interactive Browser & Developer Setup](#-interactive-browser--developer-setup)
+- [Localization Packs](#-localization-packs)
- [File Structure](#-file-structure)
- [Statistics](#-statistics)
- [Data Schema](#-data-schema)
@@ -78,7 +82,7 @@ Each exercise entry contains:
## 🖥️ Interactive Browser & Developer Setup
-This repository includes two ready-to-use HTML tools — no server required, just open in a browser.
+This repository includes two ready-to-use HTML tools. The exercise browser can be opened directly; SQL generation in the setup guide reads `data/exercises.json` and therefore requires a local HTTP server.
> **Note:** the browser displays each exercise's 180×180 thumbnail and animation GIF alongside its metadata and instructions.
@@ -88,16 +92,42 @@ A fully client-side exercise explorer with:
- Live search across all 1,324 exercises
- Filter by category, equipment, and target muscle
- Infinite scroll grid
+- Extensible interface localization that follows the browser language on first visit and remembers later choices
+- Complete Simplified Chinese names and fitness terminology, with bilingual search and English fallback
- Click any card to see full details and instructions in English, Spanish, Italian, Turkish, Russian, Chinese, Hindi, Polish, or Korean
### `setup.html` — Developer Setup Guide
A step-by-step guide for integrating the dataset into your own application:
-1. **Database Setup** — `CREATE TABLE` SQL for SQL Server, PostgreSQL, MySQL, and SQLite. Generate a ready-to-run `.sql` file with all 1,324 INSERT statements, built entirely in your browser.
+1. **Database Setup** — `CREATE TABLE` SQL for SQL Server, PostgreSQL, MySQL, and SQLite. Generate a ready-to-run `.sql` file with all 1,324 exercises and every registered non-base locale. Localized records use the generic `exercise_translations` table.
2. **API Integration** — Copy-paste client code in **JavaScript, Python, C#, Java, PHP, Go, and cURL** showing how to call your backend API. Enter your base URL and all examples update live.
3. **Ask Your LLM** — A structured prompt (choose your framework + database) that you can paste into ChatGPT, Claude, or Gemini to generate a complete, production-ready REST API in one shot. Supports Express.js, FastAPI, ASP.NET Core, Spring Boot, Laravel, and Gin.
+To generate SQL locally, serve the repository and open the setup page:
+
+```bash
+python3 -m http.server 8000
+```
+
+Then visit `http://localhost:8000/setup.html`.
+
+---
+
+## 🌐 Localization Packs
+
+Runtime translations are separate from the canonical dataset. `data/exercises.json` remains unchanged, while each UI locale is a classic UTF-8 JavaScript file that works when `index.html` is opened through `file://`.
+
+Each locale pack contains both pages' UI messages, instruction-language labels, taxonomy mappings, and optional per-exercise `{ name, steps }` translations. English uses the canonical dataset directly; `locales/zh-CN.js` supplies complete Simplified Chinese translations for all 1,324 records.
+
+To add a language:
+
+1. Copy `locales/en.js` to a BCP 47 filename such as `locales/fr-FR.js`.
+2. Translate that one file. Partial exercise translations are allowed and fall back to English.
+3. Add one metadata entry to `locales/manifest.js`. The HTML files do not need to change.
+
+The setup guide exports explicit non-base translations into a generic table keyed by `(exercise_id, locale)`, so adding a locale never requires a new database column.
+
---
## 📂 File Structure
@@ -107,11 +137,18 @@ exercises-dataset/
├── data/
│ ├── exercises.json # Full dataset — 1,324 exercise records (JSON array)
│ └── exercises.schema.json # JSON Schema (2020-12) describing every record
+├── locales/
+│ ├── runtime.js # Shared browser i18n runtime
+│ ├── manifest.js # Registered locale metadata
+│ ├── en.js # English interface locale
+│ └── zh-CN.js # Complete Simplified Chinese locale pack
├── images/ # 1,324 × 180×180 thumbnails (© Gym visual)
├── videos/ # 1,324 × 180×180 animation GIFs (© Gym visual)
├── index.html # Interactive exercise browser (client-side, no server needed)
├── setup.html # Developer setup guide (DB import + API integration)
├── NOTICE.md # Media attribution & license terms
+├── NOTICE.zh-CN.md # Informational Simplified Chinese translation
+├── README.zh-CN.md # Simplified Chinese documentation
└── README.md
```
@@ -119,10 +156,11 @@ exercises-dataset/
- **`data/exercises.json`** — The primary data file. A JSON array of 1,324 exercise objects with all metadata. `image` / `gif_url` point to the local 180×180 assets, and each record carries an `attribution` field; `media_id` holds the original media reference id.
- **`data/exercises.schema.json`** — A [JSON Schema](https://json-schema.org/) (Draft 2020-12) that formally describes every field, its type and constraints. Use it to validate the dataset or your own additions with any standard JSON Schema validator.
+- **`locales/`** — Shared i18n runtime and one self-contained translation file per locale. Browser localization is an overlay and does not modify the canonical JSON schema.
- **`images/`, `videos/`** — 180×180 thumbnails and animation GIFs (© [Gym visual](https://gymvisual.com/), used with permission).
- **`index.html`** — Standalone exercise browser. Open directly in any modern browser.
-- **`setup.html`** — Developer guide for DB setup, API integration, and LLM-assisted backend generation.
-- **`LICENSE`, `NOTICE.md`** — MIT (code/data) + the Gym visual media terms.
+- **`setup.html`** — Developer guide for DB setup, API integration, and LLM-assisted backend generation. SQL generation requires HTTP access to the external JSON file.
+- **`LICENSE`, `NOTICE.md`** — MIT (code/data) + the Gym visual media terms. [`NOTICE.zh-CN.md`](NOTICE.zh-CN.md) is an informational translation; the English notice remains authoritative.
---
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 00000000..fe77f44e
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,212 @@
+[English](README.md) · **简体中文**
+
+
+
+本仓库同时提供可扩展的浏览器多语言系统。简体中文动作名、健身术语、页面文案和精修训练步骤全部集中在 [`locales/zh-CN.js`](locales/zh-CN.js),不会向基础 JSON 增加 `_zh` 字段,也不会改变原有 Schema。
+
+## 数据内容
+
+- 1,324 个动作及其分类、身体部位、器械、目标肌肉和协同肌群
+- 每个动作一张 180×180 缩略图和一个 GIF 动画
+- 9 种语言的完整说明与分步说明
+- 可直接打开的动作浏览器 `index.html`
+- 数据库导入、API 示例和大模型提示词页面 `setup.html`
+- 覆盖全部 1,324 个动作的简体中文语言包
+
+媒体文件 © [Gym visual](https://gymvisual.com/),许可和署名要求请阅读 [`NOTICE.md`](NOTICE.md);[`NOTICE.zh-CN.md`](NOTICE.zh-CN.md) 仅为辅助译文。
+
+## 动作浏览器与开发接入
+
+### `index.html`
+
+直接双击打开即可使用,支持:
+
+- 英文和简体中文界面,首次访问跟随浏览器语言,之后记住用户选择
+- 使用中英文动作名、分类、器械和肌肉术语搜索
+- 按分类、器械和目标肌肉筛选,切换语言不会丢失筛选状态
+- 无限滚动、响应式卡片和动作详情弹窗
+- 查看数据集中已有的 9 种语言训练步骤
+- 中文模式优先显示语言包中精修后的中文动作名和步骤
+
+### `setup.html`
+
+页面本身可以直接打开并切换语言,但浏览器通常禁止 `file://` 页面读取外部 JSON。生成 SQL 时请在仓库目录启动本地 HTTP 服务:
+
+```bash
+python3 -m http.server 8000
+```
+
+然后访问 `http://localhost:8000/setup.html`。
+
+setup 支持 SQL Server、PostgreSQL、MySQL 和 SQLite,可导出:
+
+- 1,324 条基础动作记录
+- manifest 中所有已注册非基础语言包的显式翻译
+- 使用 `(exercise_id, locale)` 作为主键的通用 `exercise_translations` 表
+
+SQL Server 使用 `NVARCHAR` 和 `N'…'` Unicode 字面量,MySQL 使用 `utf8mb4`,PostgreSQL 使用 `JSONB`,SQLite 使用 UTF-8 文本和 JSON 字符串。
+
+## 可扩展语言包
+
+```text
+locales/
+├── runtime.js # 共享 i18n 运行时、回退和语言记忆
+├── manifest.js # 已注册语言及文件路径
+├── en.js # 英文页面文案,动作内容使用基础数据
+└── zh-CN.js # 完整简体中文语言包
+```
+
+每种语言只维护一个经典 UTF-8 JavaScript 文件,结构如下:
+
+```js
+window.ExercisesI18n.registerLocale({
+ code: 'zh-CN',
+ label: '简体中文',
+ instructionCode: 'zh',
+ dir: 'ltr',
+ complete: true,
+ ui: {
+ index: {},
+ setup: {}
+ },
+ instructionLabels: {},
+ taxonomy: {
+ categories: {},
+ bodyParts: {},
+ equipment: {},
+ targets: {},
+ muscles: {}
+ },
+ records: {
+ '0001': {
+ name: '3/4 仰卧起坐',
+ steps: ['平躺,膝盖弯曲,双脚平放在地上。']
+ }
+ }
+});
+```
+
+新增语言时:
+
+1. 复制 `locales/en.js`,文件名使用 BCP 47 代码,例如 `fr-FR.js`。
+2. 只在该文件中翻译 index、setup、术语和动作内容。
+3. 在 `locales/manifest.js` 增加一行语言代码、显示名和文件路径。
+
+不需要修改 `index.html` 或 `setup.html`。语言包可以逐步完成;缺失项目会逐项回退英文,SQL 只导出明确提供的翻译,不会把英文回退内容标记成目标语言。
+
+## 文件结构
+
+```text
+exercises-dataset/
+├── data/
+│ ├── exercises.json # 1,324 条规范基础记录
+│ └── exercises.schema.json # JSON Schema 2020-12
+├── locales/ # 浏览器 i18n 运行时和语言包
+├── images/ # 1,324 张 180×180 缩略图
+├── videos/ # 1,324 个 GIF 动画
+├── index.html # 动作浏览器
+├── setup.html # 数据库和 API 接入指南
+├── README.md # 英文说明
+├── README.zh-CN.md # 本文件
+├── NOTICE.md # 权威英文媒体声明
+├── NOTICE.zh-CN.md # 中文辅助译文
+└── LICENSE
+```
+
+## 基础数据结构
+
+[`data/exercises.json`](data/exercises.json) 是规范数据源,保留上游原始字段:
+
+| 字段 | 说明 |
+|---|---|
+| `id` | 四位动作 ID,例如 `"0001"` |
+| `name` | 规范英文动作名 |
+| `category`、`body_part` | 英文身体部位分类 |
+| `equipment` | 英文器械名称 |
+| `instructions.
` | 各语言完整训练说明 |
+| `instruction_steps.` | 各语言分步说明数组 |
+| `muscle_group` | 主要协同肌群 |
+| `secondary_muscles` | 辅助肌群数组 |
+| `target` | 主要目标肌肉 |
+| `media_id` | 原始媒体引用 ID |
+| `image`、`gif_url` | 本地缩略图和 GIF 路径 |
+| `attribution` | 媒体版权署名 |
+| `created_at` | ISO 8601 创建时间 |
+
+中文动作名和术语不写入基础 JSON,而是在浏览器运行时按动作 ID 和英文 canonical value 叠加。因此现有 JSON 使用方、Schema 和英文筛选值都保持兼容。
+
+## 通用翻译表
+
+setup 生成的数据库结构在上游 `exercises` 表之外增加:
+
+```text
+exercise_translations
+- exercise_id
+- locale
+- name
+- category
+- body_part
+- equipment
+- target
+- muscle_group
+- secondary_muscles
+- instructions
+- instruction_steps
+- PRIMARY KEY (exercise_id, locale)
+- FOREIGN KEY (exercise_id) REFERENCES exercises(id)
+```
+
+英文仍由 `exercises` 表承载。当前完整中文包会写入 1,324 条 `locale = 'zh-CN'` 的翻译记录;以后新增语言不会要求增加新的数据库列。
+
+## 使用基础 JSON
+
+Python:
+
+```python
+import json
+
+with open("data/exercises.json", "r", encoding="utf-8") as file:
+ exercises = json.load(file)
+
+print(len(exercises))
+print(exercises[0]["name"])
+print(exercises[0]["instructions"]["zh"])
+```
+
+Node.js:
+
+```js
+const exercises = require('./data/exercises.json');
+
+console.log(exercises.length);
+console.log(exercises[0].name);
+console.log(exercises[0].instruction_steps.zh);
+```
+
+## 许可与使用
+
+- 代码、数据结构和训练说明采用 [`LICENSE`](LICENSE) 中的 MIT License。
+- 图片和 GIF 动画归 [Gym visual](https://gymvisual.com/) 所有,经许可仅以 180×180 分辨率重新分发。
+- 使用媒体时必须保留 `© Gym visual — https://gymvisual.com/` 署名,并遵守 Gym visual 的条款。
+- 中文 [`NOTICE.zh-CN.md`](NOTICE.zh-CN.md) 仅供参考;涉及许可时以英文 [`NOTICE.md`](NOTICE.md)、[`LICENSE`](LICENSE) 和权利人的原始条款为准。
diff --git a/index.html b/index.html
index 1acce807..8278169a 100644
--- a/index.html
+++ b/index.html
@@ -90,6 +90,34 @@
color: var(--accent);
}
+ .sidebar-actions {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+ }
+
+ .language-select {
+ width: 100%;
+ padding: 5px 22px 5px 8px;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-sm);
+ background: var(--bg-elevated);
+ color: var(--text-secondary);
+ font: inherit;
+ font-size: 12px;
+ font-weight: 500;
+ cursor: pointer;
+ outline: none;
+ margin-bottom: 4px;
+ }
+
+ .language-select:hover,
+ .language-select:focus {
+ border-color: var(--accent);
+ color: var(--text-primary);
+ }
+
.sidebar-body {
padding: 12px 12px 24px;
display: flex;
@@ -1030,42 +1058,45 @@