Skip to content

Add extensible localization support and Simplified Chinese#52

Open
marcomarcogd wants to merge 3 commits into
hasaneyldrm:mainfrom
marcomarcogd:agent/extensible-i18n-zh-cn
Open

Add extensible localization support and Simplified Chinese#52
marcomarcogd wants to merge 3 commits into
hasaneyldrm:mainfrom
marcomarcogd:agent/extensible-i18n-zh-cn

Conversation

@marcomarcogd

@marcomarcogd marcomarcogd commented Jul 14, 2026

Copy link
Copy Markdown

Summary

This supersedes the closed #51 with a smaller, extensible localization architecture. The canonical dataset and schema remain unchanged; browser localization is provided by one self-contained classic JavaScript file per locale.

Translation review revision

  • Completed two independent, record-by-record review passes over all 1,324 exercise names and 7,662 Simplified Chinese instruction steps. Each pass compared the canonical English name/steps, the upstream Chinese instructions, and the current locale text; ambiguous equipment, grip, direction, angle, stance, or movement paths were checked against the corresponding image or GIF.
  • Also reviewed all 107 taxonomy labels (10 categories, 10 body parts, 28 equipment values, 19 targets, and 40 muscle terms) and all 90 interface messages (41 index + 49 setup). These maps/messages required no changes in this revision.
  • Applied confirmed corrections to 359 records: 60 names and 990 individual instruction steps across 352 records. No step arrays were added, removed, or resegmented.
  • Corrected source/media mismatches without changing the canonical dataset. Examples include 0059, 0137, 0165, 0229, 0240, 1275, 2189, 2402, 2414, 2705, 2706, 2799, 2800, 2801, 2802, 3011, 3012, 3156, 3162, 3195, 3200, 3237, 3286, 3287, 3298, 3301, 3318, 3533, 3637, 3641, 3665, 3758, and 3759. These are localization-overlay corrections only; the upstream English/source records remain untouched.
  • Removed machine-translation residue and corrected Mainland fitness terminology, including cable vs. dumbbell conflicts, pronated/supinated/neutral grips, unilateral/bilateral variants, seated/standing/lying positions, incline/decline wording, Smith-machine unlocking, hip-hinge wording, BOSU/ASCII spacing, and duplicate-name disambiguation.
  • Resolved three non-equivalent duplicate Chinese-name groups; the remaining 14 groups are explicit source duplicates or genuine synonyms and were retained rather than renamed artificially.
  • Used 地雷杆 for landmine terminology, 西斯深蹲 for sissy squat, and Chinese names plus the English original for ambiguous planche variants. Terminology references: Beijing Sports Bureau training material, Sissy squat usage, Planche / 俄式挺身, and the CrossFit Chinese training guide.
  • Left uncertain portions unchanged when the two passes could not confirm one interpretation. No speculative full rewrite was made for ambiguous records such as 0304/0305, 0337, 0371, 0445, 0474, 0524, 0539, 0551, 0574, 0589, 0636, 0668, 0672, 0755, 1303, 1320, 1416, 1512, 1548, 1604, 1638, 1689, 1758, 2207, 3289, 3292, 3302, and 3638. Known canonical conflicts 0365/0366/0397 and 3288 also remain unchanged.

Corrected record IDs

Name only (7)

1278, 1369, 1734, 1740, 2188, 0425, 0562

Instruction steps only (299)

1000, 1005, 1009, 1010, 1015, 1023, 1201, 1256, 1257, 1258, 1261, 1263, 1272, 1274, 1275, 1277, 1279, 1280, 1292, 1296, 1302, 1304, 1305, 1307, 1308, 1309, 1310, 1311, 1325, 1332, 1339, 1342, 1352, 1354, 1367, 1370, 1374, 1381, 1385, 1386, 1391, 1392, 1394, 1396, 1401, 1405, 1415, 1417, 1418, 1432, 1434, 1439, 1459, 1463, 1464, 1467, 1512, 1548, 1587, 1615, 1621, 1625, 1627, 1631, 1645, 1646, 1647, 1648, 1653, 1656, 1661, 1662, 1664, 1670, 1671, 1705, 1718, 1719, 1721, 1725, 1727, 1729, 1743, 1744, 1753, 1754, 1755, 1756, 1764, 1770, 1772, 2139, 2202, 2203, 2205, 2206, 2208, 2209, 2271, 2287, 2318, 2321, 2328, 2363, 2398, 2401, 2459, 2462, 2616, 2705, 2706, 3011, 3117, 3156, 3158, 3162, 3166, 3195, 3217, 3234, 3281, 3290, 3291, 3295, 3296, 3297, 3304, 3312, 3313, 3314, 3315, 3523, 3541, 3542, 3544, 3545, 3560, 3662, 3667, 3670, 3758, 3759, 3760, 5201, 0011, 0968, 0980, 0976, 0986, 0991, 0023, 0028, 0030, 0032, 0033, 0034, 0035, 0036, 0037, 0038, 0047, 0048, 0055, 0074, 0081, 0085, 0090, 0104, 0113, 0114, 0115, 0116, 0137, 0870, 0152, 0157, 0165, 0169, 0171, 0172, 0173, 0196, 0204, 0220, 0231, 0240, 0258, 0272, 0279, 0284, 0290, 0291, 0294, 0300, 0311, 0313, 0312, 0320, 0323, 0325, 0328, 0332, 0339, 0347, 0349, 0363, 0370, 0374, 0379, 0398, 0410, 0432, 0434, 0436, 0438, 0446, 0450, 0454, 0467, 0469, 0489, 0488, 0490, 0492, 0494, 0508, 0517, 0518, 0520, 0526, 0527, 0529, 0530, 0531, 0533, 0535, 0537, 0542, 0545, 0547, 0549, 0555, 0558, 0571, 0578, 0580, 0588, 0593, 0595, 0596, 0609, 0865, 0627, 0634, 0653, 0661, 0670, 0678, 0687, 0688, 0717, 0720, 0725, 0741, 0746, 0748, 0749, 0750, 0751, 0752, 0754, 0755, 0757, 0758, 0760, 0761, 0762, 0768, 0769, 0770, 0771, 0776, 0798, 0803, 0805, 0806, 0809, 0811, 0813, 0815, 0830, 0833, 0866, 0835, 0841, 0846, 0852, 0856, 0859

Name and instruction steps (53)

1489, 1748, 2189, 2402, 2403, 2404, 2405, 2406, 2407, 2414, 2799, 2800, 2801, 2802, 2803, 2805, 3012, 3013, 3200, 3237, 3286, 3287, 3298, 3301, 3318, 3327, 3419, 3533, 3637, 3641, 3665, 0059, 0229, 0382, 0384, 0399, 0403, 0429, 0448, 0451, 0452, 0458, 0552, 0631, 0650, 0656, 0684, 0709, 0753, 0759, 0807, 0826, 0851

What changed

Extensible localization runtime

  • Added locales/runtime.js for locale loading, message formatting, granular English fallback, browser-language detection, persisted preference, localized taxonomy lookup, and localized instruction resolution.
  • Added locales/manifest.js with en and zh-CN. A new language requires one locale file plus one manifest entry; neither HTML page needs to change.
  • Locale packs use classic scripts rather than ES modules or fetched JSON, so index.html continues to work through file://.
  • Initial locale resolution is saved preference, then explicit browser-language matching, then English. zh-CN, zh-SG, and zh-Hans variants map to Simplified Chinese; Traditional Chinese locales do not map automatically.
  • Partial locale packs are supported. Missing UI messages, taxonomy labels, exercise names, or steps fall back to canonical English values item by item.

Complete Simplified Chinese locale

  • Added locales/zh-CN.js with both pages' UI, accessibility labels, setup/LLM messages, instruction-language labels, fitness taxonomy, and explicit translations for 1,324 unique exercise IDs.
  • Every translated record has a non-empty Chinese name and non-empty step array.
  • Added locales/en.js as the base UI locale. Exercise content continues to come directly from the canonical English dataset.

Exercise browser

  • Added a manifest-driven language selector, localized static UI/accessibility text, and locale-aware re-rendering.
  • Added bilingual search across canonical English and localized names/taxonomy.
  • Filter values remain canonical English internally, so active filters survive language switching.
  • Localized cards, counts, empty states, filter labels, metadata, muscles, and modal content.
  • The details modal prefers the current locale pack's reviewed steps while retaining all nine existing instruction-language tabs.
  • The upstream embedded canonical dataset was not reserialized and remains byte-for-byte unchanged.

Developer setup and SQL export

  • Localized the setup UI, status messages, accessibility labels, copy feedback, and LLM prompt.
  • Removed the embedded dataset from setup.html; SQL generation reads data/exercises.json only when requested, preserving the upstream server-deployment fetch path.
  • Added the generic exercise_translations table keyed by (exercise_id, locale), with a foreign key to exercises.
  • SQL generation loads registered locale packs and exports only explicit non-base translations; partial packs never export English fallback as target-language content.
  • Current exports contain 1,324 canonical exercise rows and 1,324 explicit zh-CN translation rows.
  • SQL Server uses NVARCHAR and N'…'; MySQL uses utf8mb4; PostgreSQL uses JSONB; SQLite and SQL Server store JSON arrays as Unicode text.
  • Added a small mobile-only CSS correction so setup selector groups wrap or scroll within a 390 px viewport; no HTML structure or generation logic changed.

Documentation and notices

  • Updated README.md and README.zh-CN.md with the two-pass review scope, localization-pack format, deployed dataset loading, and translation-table documentation.
  • Linked English and Chinese notices and added NOTICE.zh-CN.md as an informational translation.
  • LICENSE is unchanged, and the English notice remains authoritative.

Compatibility and scope

  • data/exercises.json and data/exercises.schema.json are identical to upstream.
  • No canonical fields were removed, renamed, or added.
  • No data-generation, synchronization, or translation-rule scripts are included.
  • Existing source-data inconsistencies are disclosed above and remain outside the canonical data.

Validation

  • Confirmed 1,324 canonical records, 1,324 unique IDs, 2,648 media paths, 1,324 complete zh-CN records, and 7,662 non-empty Simplified Chinese steps.
  • Confirmed taxonomy counts of 10/10/28/19/40 and UI key counts of 41/49 with matching placeholders.
  • Confirmed canonical JSON, schema, and the embedded index.html dataset match upstream exactly; the embedded JSON bytes are unchanged.
  • Scanned equipment conflicts, grip/direction wording, machine-translation residue, unexpected English, CJK/ASCII spacing, invisible Unicode, adjacent duplicate steps, and duplicate names. Remaining equipment-name hits are the intentional rope-climb term at 0680 and the barbell-plate term at 0854.
  • Parsed all locale scripts and both HTML inline scripts; git diff --check passes.
  • Generated SQL for SQL Server, PostgreSQL, MySQL, and SQLite: each contains 1,324 base inserts and 1,324 translation inserts.
  • Imported SQLite SQL into a temporary database and read back 1,324 base rows plus 1,324 UTF-8 zh-CN rows; foreign-key validation returned no errors.
  • Browser-tested index.html through file://: Simplified Chinese default, English switch and saved preference, Chinese/English search, canonical filters across language switches, infinite scroll (60 → 120 cards), localized detail modal, all nine instruction tabs, and 390 px mobile layout.
  • Browser-tested setup.html through HTTP: Chinese/English UI and LLM prompts, all four SQL downloads, and 390 px mobile layout. Through file://, generation fails with the normal localized error only and no local-server-specific prompt.
  • Verified nine locale-resolution cases, including zh-CN/zh-SG/zh-Hans matching and zh-TW/zh-HK falling back to English. No browser runtime exceptions were observed.

Files changed

  • Modified: README.md, NOTICE.md, index.html, setup.html
  • Added: README.zh-CN.md, NOTICE.zh-CN.md, locales/runtime.js, locales/manifest.js, locales/en.js, locales/zh-CN.js

This PR remains ready for review and allows maintainer edits.

@marcomarcogd marcomarcogd marked this pull request as draft July 14, 2026 06:02
@marcomarcogd marcomarcogd marked this pull request as ready for review July 14, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant