-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(i18n): add Portuguese instructions (European ptPT + Brazilian ptBR) #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tutods
wants to merge
6
commits into
hasaneyldrm:main
Choose a base branch
from
tutods:feat/add-portuguese-instructions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
637a329
docs: add CLAUDE.md
tutods b6d8ecf
Add Portuguese (pt) exercise instructions
tutods d1efead
chore: remove translation pipeline scripts from PR
tutods 370ca80
feat: add Brazilian Portuguese (ptBr) exercise instructions
tutods d922f6b
docs(readme): list 12 languages incl. Brazilian Portuguese
tutods 93475e2
refactor(i18n): rename Portuguese keys pt->ptPT, ptBr->ptBR
tutods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # exercises-dataset | ||
|
|
||
| ## Purpose | ||
|
|
||
| Fork of `hasaneyldrm/exercises-dataset` (1,324 fitness exercises: JSON data + GIF/thumbnail media + instructions in 11 languages). This fork's job: add **European Portuguese (`pt`)** instructions via the pipeline in `scripts/`, then contribute the result upstream as a PR — mirroring how the French PR (commit `6f3031b`) was structured. Not an app; a data repo with a Python pipeline. | ||
|
|
||
| ## Stack | ||
|
|
||
| - Python 3 (system `python3`, currently 3.9) — stdlib only for scripts 1/3/4; script 2 calls any OpenAI-compatible HTTP endpoint. No package manager, no venv, no Node. | ||
| - Data: `data/exercises.json` (18 MB) validated by `data/exercises.schema.json`. | ||
| - `index.html` (17 MB) embeds a full inline copy of the dataset in one `const EXERCISES = [...]` line. | ||
|
|
||
| ``` | ||
| data/ exercises.json + JSON Schema — the source of truth | ||
| scripts/ PT-PT translation pipeline (see scripts/README.md — read it first) | ||
| glossary_pt.json pinned PT-PT fitness terminology (~150 terms) | ||
| en_strings.json unique EN strings (generated by step 1) | ||
| translations*.json, chunks/ intermediate outputs — never hand-edit | ||
| images/ videos/ 1,324 thumbnails + GIFs (© Gym visual — licensed media, never modify) | ||
| index.html interactive browser with inline dataset copy | ||
| ``` | ||
|
|
||
| ## Commands | ||
|
|
||
| Full pipeline, in order (details + env vars in `scripts/README.md`): | ||
|
|
||
| ```bash | ||
| python3 scripts/1_extract_unique.py # dedup EN steps → en_strings.json | ||
| python3 scripts/2_translate.py # needs OPENAI_API_KEY; resumable | ||
| python3 scripts/3_apply.py # writes pt into exercises.json, enforces 6 invariants | ||
| python3 scripts/4_sync_index_html.py # regenerates inline JSON in index.html | ||
| python3 scripts/3_apply.py --check # verify — this is the test suite | ||
| ``` | ||
|
|
||
| ## Conventions | ||
|
|
||
| - `scripts/README.md` is the pipeline's authoritative doc — keep it in sync with any script change. | ||
| - The 6 invariants in `3_apply.py` are hard rules (schema-valid; `pt` step count == `en`; `instructions.pt` joins the steps; pre-existing fields byte-identical; no empty strings; `pt` last key after `fr`). Never weaken them to make a run pass. | ||
| - Translation register is impersonal 3rd person, no subject pronoun (`Deite-se`, `Mantenha`, `Repita`) — PT-PT, never PT-BR. Terms in `glossary_pt.json` are pinned: if the English source contains a glossary term, the mapped translation is mandatory. | ||
| - Scripts are stdlib-only, `from __future__ import annotations`, runnable on Python 3.9 — don't add pip dependencies. | ||
| - README.md follows upstream's style (badges, emoji headers) — match it when editing; changes here should stay upstream-mergeable. | ||
|
|
||
| ## Definition of Done | ||
|
|
||
| - [ ] `python3 scripts/3_apply.py --check` passes (all 6 invariants) | ||
| - [ ] If `data/exercises.json` changed, `python3 scripts/4_sync_index_html.py` was re-run (data and index.html must never diverge) | ||
| - [ ] No hand edits to generated files (`en_strings.json`, `translations*.json`, `chunks/`, the inline JSON in `index.html`) | ||
| - [ ] `git status` reviewed — media files (`images/`, `videos/`) untouched | ||
|
|
||
| ## Gotchas | ||
|
|
||
| - **Never read `index.html` or `data/exercises.json` fully** — 17–18 MB each. Use `head`, `rg`, or `jq` for targeted slices; `jq '.[0]'` shows a record shape. | ||
| - The inline `EXERCISES` line in `index.html` is one 16 MB line — only `4_sync_index_html.py` may touch it. | ||
| - `translations_partial_*.json` and `chunks/` are resumable-run intermediates of `2_translate.py`; deleting them loses paid translation progress. | ||
| - `2_translate.py` costs money (LLM API) — never run it unprompted; it's resumable, so partial runs are safe to continue. | ||
| - **Preferred translation path: the assistant translates directly** (chunk by chunk from `scripts/chunks/`, glossary-pinned) — never pull another model (ollama etc.) or call a paid API for work you can do yourself. This was corrected explicitly. | ||
| - Media is © Gym visual with its own license terms (see LICENSE/NOTICE.md) — data is MIT, media is not. | ||
| - Upstream is `hasaneyldrm/exercises-dataset`; `origin` is the `tutods` fork. The end goal of local work is an upstream PR, so keep the diff minimal and PR-shaped (like the French PR `6f3031b`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.