From cc116bdbcc0127e1d49ed40f4ded0e3d30ce0dd5 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Sat, 19 Sep 2026 21:17:20 +0200 Subject: [PATCH 1/3] Custom exercises: the target muscle is the primary tapped first, not the topmost one on the map (QA C10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the muscles are stored in the map's order, the one-word target `tg` was taken from the head of that sorted list, so a hip thrust or deadlift with Traps as an extra primary showed up as "Traps · barbell" in the library, the picker and the Muscles view — and because tap order was discarded, the user had no way to correct it. The list stays in map order; the target is the primary the user picked first, and editing an exercise keeps its target as long as that muscle is still a primary. Rig check on the branch build (slot 71, 368 px, Hamstrings → Glutes → Traps): stored primaries ['trapezius','gluteal','hamstring'], tg 'hamstring'; library row, picker row and Muscles > Glutes / Hamstrings all read "Hamstrings · barbell". --- frontend/src/sheets.custom-target.test.jsx | 113 +++++++++++++++++++++ frontend/src/sheets.jsx | 8 +- 2 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 frontend/src/sheets.custom-target.test.jsx diff --git a/frontend/src/sheets.custom-target.test.jsx b/frontend/src/sheets.custom-target.test.jsx new file mode 100644 index 0000000..2b87ee7 --- /dev/null +++ b/frontend/src/sheets.custom-target.test.jsx @@ -0,0 +1,113 @@ +// @vitest-environment happy-dom +// QA C10. Since the muscles of a custom exercise are stored in the map's order (83b2a14), the +// one-word target `tg` was silently taken from the sorted list: a hip thrust with Traps as an +// extra primary became a "Traps" exercise in the library, the picker and the Muscles view, and +// tap order no longer let the user correct it. The target is the primary picked first; an edit +// keeps the old target while it is still a primary. +import React, { act } from 'react' +import { afterEach, beforeEach, describe, expect, it } from 'vitest' +import { createRoot } from 'react-dom/client' +import { EXIDX, registerCustom } from './lib/exercises.js' +import { DEF, useStore } from './store/useStore.js' +import { useUI } from './store/useUI.js' +import { _setLangState } from './lib/i18n-core.js' +import { bindUI } from './components/ui.jsx' +import { customExSheet } from './sheets.jsx' + +bindUI(useUI) // the multi-select rows open their sheet through the shared controls + +const mounted = [] +const S = () => useStore.getState().S + +// Renders whatever sheet is on top and returns its host element. +function renderTop() { + const sheet = useUI.getState().sheets.at(-1) + const host = document.createElement('div') + document.body.appendChild(host) + const root = createRoot(host) + mounted.push(root) + act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id)))) + return host +} +function type(el, value) { + Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value) + el.dispatchEvent(new Event('input', { bubbles: true })) +} +const byText = (host, sel, text) => [...host.querySelectorAll(sel)].find(e => e.textContent.trim() === text) +const click = (host, sel, text) => { + const el = byText(host, sel, text) + if (!el) throw new Error(`nothing with text "${text}"`) + act(() => el.click()) +} +// The form's multi-select rows open a nested sheet; tap the given labels there, in order, then Done. +function pickMuscles(form, rowTitle, labels) { + const row = [...form.querySelectorAll('.lrow')].find(e => e.textContent.includes(rowTitle)) + act(() => row.click()) + const sub = renderTop() + for (const l of labels) click(sub, 'button', l) + click(sub, 'button', 'Done') +} +const custom = (over = {}) => ({ + id: 'cqa1', n: 'QA Custom Thrust', bp: 'upper legs', eq: 'barbell', custom: true, desc: '', + tg: 'gluteal', sm: ['forearm', 'hip-flexors'], primaries: ['gluteal'], secondaries: ['forearm', 'hip-flexors'], + muscleGroups: ['gluteal', 'forearm', 'hip-flexors'], ...over, +}) +function seed(ex) { + useStore.setState(s => ({ S: { ...s.S, customEx: [ex] } })) + registerCustom([ex]) +} + +beforeEach(() => { + globalThis.IS_REACT_ACT_ENVIRONMENT = true + useUI.setState({ sheets: [], toastMsg: '' }) + useStore.setState({ S: structuredClone(DEF), user: null }) + registerCustom([]) + _setLangState('en', null, null, null) + document.body.innerHTML = '' +}) + +afterEach(() => { + act(() => { mounted.splice(0).forEach(root => root.unmount()) }) + _setLangState('en', null, null, null) + registerCustom([]) +}) + +describe('custom exercise target (QA C10)', () => { + it('is the primary tapped first, while the stored list keeps the map order', () => { + customExSheet(null) + const form = renderTop() + act(() => type(form.querySelector('input.input'), 'QA Hip Thrust Pull')) + click(form, '.chip', 'upper legs') + click(form, '.chip', 'barbell') + pickMuscles(form, 'Primary muscle groups', ['Hamstrings', 'Glutes', 'Traps']) + click(form, 'button', 'Create exercise') + const c = S().customEx.find(x => x.n === 'QA Hip Thrust Pull') + expect(c.primaries).toEqual(['trapezius', 'gluteal', 'hamstring']) + expect(c.tg).toBe('hamstring') + expect(c.muscleGroups).toEqual(['trapezius', 'gluteal', 'hamstring']) + }) + + it('survives an edit that adds a primary higher up the body', () => { + const ex = custom({ tg: 'hamstring', primaries: ['gluteal', 'hamstring'], secondaries: [], sm: [], muscleGroups: ['gluteal', 'hamstring'] }) + seed(ex) + customExSheet(EXIDX[ex.id]) + const form = renderTop() + pickMuscles(form, 'Primary muscle groups', ['Traps']) + click(form, 'button', 'Save') + const c = S().customEx[0] + expect(c.primaries).toEqual(['trapezius', 'gluteal', 'hamstring']) + expect(c.tg).toBe('hamstring') + }) + + it('moves to another primary only when the old target is dropped', () => { + const ex = custom({ tg: 'hamstring', primaries: ['gluteal', 'hamstring'], secondaries: [], sm: [], muscleGroups: ['gluteal', 'hamstring'] }) + seed(ex) + customExSheet(EXIDX[ex.id]) + const form = renderTop() + pickMuscles(form, 'Primary muscle groups', ['Hamstrings']) // untick it + click(form, 'button', 'Save') + const c = S().customEx[0] + expect(c.primaries).toEqual(['gluteal']) + expect(c.tg).toBe('gluteal') + }) +}) diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx index 019bd88..6b872a5 100644 --- a/frontend/src/sheets.jsx +++ b/frontend/src/sheets.jsx @@ -795,13 +795,17 @@ function CustomExForm({ existing, prefill, onDone, close }) { const prim = bp === 'cardio' ? ['cardiovascular system'] : inMuscleOrder(primaries) const sm = inMuscleOrder(secondaries.filter(m => !prim.includes(m))) const groups = [...prim, ...sm] + // The one-word target (the library row, the picker, the Muscles view) is not the sorted list's + // head — a hip thrust with Traps as an extra primary is not a Traps exercise. It is the primary + // tapped first, and an edit keeps the exercise's target as long as that muscle is still a primary. + const tg = (existing && prim.includes(existing.tg)) ? existing.tg : (primaries.find(m => prim.includes(m)) || prim[0] || '') let id = existing && existing.id if (existing) update(s => { const c = (s.customEx || []).find(x => x.id === id); if (c) { - c.n = name; c.bp = bp; c.desc = d; c.tg = prim[0] || ''; c.sm = sm; c.muscleGroups = groups; c.primaries = prim; c.secondaries = sm; c.eq = eq + c.n = name; c.bp = bp; c.desc = d; c.tg = tg; c.sm = sm; c.muscleGroups = groups; c.primaries = prim; c.secondaries = sm; c.eq = eq } }) else { id = 'c' + uid() - update(s => { (s.customEx = s.customEx || []).push({ id, n: name, bp, desc: d, tg: prim[0] || '', sm, muscleGroups: groups, primaries: prim, secondaries: sm, eq, custom: true }) }) + update(s => { (s.customEx = s.customEx || []).push({ id, n: name, bp, desc: d, tg, sm, muscleGroups: groups, primaries: prim, secondaries: sm, eq, custom: true }) }) } close() toast(existing ? t('Saved') : t('“{0}” created', name)) From 2bf86a531853f4615eaad098201d8d1579c9ce1e Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Sat, 19 Sep 2026 21:17:20 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Muscle=20names=20in=20the=20picker=20row,?= =?UTF-8?q?=20config=20sheet,=20Muscles=20rows=20and=20the=20workout=20tag?= =?UTF-8?q?=20go=20through=20MUSCLE=5FNAME=20=E2=80=94=20"gluteal",=20"for?= =?UTF-8?q?earm"=20and=20"hip-flexors"=20leaked=20as=20raw=20ids,=20and=20?= =?UTF-8?q?"forearm"=20stayed=20English=20in=20German=20(QA=20C9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Custom exercises and the batch-1/Olympic metadata (#207) name muscles by the map's ids, for which only the display names in MUSCLE_NAME have translations. The detail sheet and the Library row already mapped through it; the picker row subtitle, the routine config sheet tags, the Muscles explorer rows and the tag under the exercise name in a workout translated the id directly. Rig check on the branch build (slot 71, en + de): picker row "Glutes · barbell" / "Gesäß · Langhantel", custom config tags Glutes/barbell/Forearms/Hip flexors, power clean config tags in German Beinbeuger/Langhantel/Waden/Unterarme/Schultern, Muscles > Glutes "Primary target · Glutes · barbell", workout tag "Glutes" / "Gesäß". --- frontend/src/components/MuscleExplorer.jsx | 2 +- frontend/src/sheets.jsx | 10 +- frontend/src/sheets.muscle-names.test.jsx | 107 +++++++++++++++++++++ frontend/src/views/Workout.jsx | 3 +- frontend/src/views/Workout.test.jsx | 15 +++ 5 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 frontend/src/sheets.muscle-names.test.jsx diff --git a/frontend/src/components/MuscleExplorer.jsx b/frontend/src/components/MuscleExplorer.jsx index 9916377..f628d95 100644 --- a/frontend/src/components/MuscleExplorer.jsx +++ b/frontend/src/components/MuscleExplorer.jsx @@ -84,7 +84,7 @@ export default function MuscleExplorer({ onPick, onDetail, onPlan }) { const primary = musclesOf(e)[selected] === 1 return
choose(e))}> -
{isFav(S, e.id) && }{exerciseNameFor(e)}
{t(primary ? 'Primary target' : 'Also trains')} · {t(e.tg || e.bp)} · {t(e.eq)}
+
{isFav(S, e.id) && }{exerciseNameFor(e)}
{t(primary ? 'Primary target' : 'Also trains')} · {t(MUSCLE_NAME[e.tg] || e.tg || e.bp)} · {t(e.eq)}
{onPick ? : <> {best > 0 && {fmtNum(best)}} diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx index 6b872a5..e5ef020 100644 --- a/frontend/src/sheets.jsx +++ b/frontend/src/sheets.jsx @@ -946,7 +946,7 @@ function ExercisePicker({ onPick, close }) {
{t('Create your own exercise')}
{t('name + body part, no animation')}
} {f.slice(0, shown).map(e =>
onPick(e))}> -
{isFav(st, e.id) && }{exerciseNameFor(e)}
{t(e.tg || e.bp)} · {t(e.eq)}
+
{isFav(st, e.id) && }{exerciseNameFor(e)}
{t(MUSCLE_NAME[e.tg] || e.tg || e.bp)} · {t(e.eq)}
{/* Accent tag = already in a routine/log ("Chosen"); the yellow star by the name = favourite. */} {usage[e.id] && } {/* A "+" glyph reads as "add this now" — it used to just open the same detail sheet as @@ -1225,12 +1225,14 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) { {/* The same tags the exercise detail sheet shows, secondaries included: choosing what goes into a plan is exactly when "what else does this hit" matters, and until now that was - only visible from the Exercises tab, after the fact. */} + only visible from the Exercises tab, after the fact. Custom exercises and the newer + metadata name muscles by the map's ids ("forearm", "gluteal"), which only MUSCLE_NAME + turns into a translatable label. */}
{cardio && {t('Cardio')}} - {t(ex.tg || ex.bp)}{t(ex.eq)} + {t(MUSCLE_NAME[ex.tg] || ex.tg || ex.bp)}{t(ex.eq)} {!cardio && (ex.secondaries?.length ? ex.secondaries : smOf(ex)).slice(0, 3) - .map((s, i) => {t(s)})} + .map((s, i) => {t(MUSCLE_NAME[s] || s)})}
{ex.desc &&
{ex.desc}
} {!cardio &&
diff --git a/frontend/src/sheets.muscle-names.test.jsx b/frontend/src/sheets.muscle-names.test.jsx new file mode 100644 index 0000000..fdb3c9a --- /dev/null +++ b/frontend/src/sheets.muscle-names.test.jsx @@ -0,0 +1,107 @@ +// @vitest-environment happy-dom +// QA C9. Custom exercises and the newer exercise metadata name muscles by the map's ids. The +// picker row, the routine config sheet and the Muscles rows printed those ids ("gluteal", +// "forearm", "hip-flexors") where the detail sheet already said Glutes / Forearms / Hip flexors — +// and in German "forearm" stayed English, because only the display names have translations. +import React, { act } from 'react' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { createRoot } from 'react-dom/client' +import { EXIDX, registerCustom } from './lib/exercises.js' +import { DEF, useStore } from './store/useStore.js' +import { useUI } from './store/useUI.js' +import { _setLangState } from './lib/i18n-core.js' +import de from './locales/de.js' +import { exercisePicker, exConfigSheet } from './sheets.jsx' +import MuscleExplorer from './components/MuscleExplorer.jsx' + +const mounted = [] +const S = () => useStore.getState().S + +// Renders whatever sheet is on top and returns its host element. +function renderTop() { + const sheet = useUI.getState().sheets.at(-1) + const host = document.createElement('div') + document.body.appendChild(host) + const root = createRoot(host) + mounted.push(root) + act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id)))) + return host +} +function render(node) { + const host = document.createElement('div') + document.body.appendChild(host) + const root = createRoot(host) + mounted.push(root) + act(() => root.render(node)) + return host +} +function type(el, value) { + Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value) + el.dispatchEvent(new Event('input', { bubbles: true })) +} +const rowFor = (host, name) => [...host.querySelectorAll('.item')].find(e => e.textContent.includes(name)) +const custom = (over = {}) => ({ + id: 'cqa1', n: 'QA Custom Thrust', bp: 'upper legs', eq: 'barbell', custom: true, desc: '', + tg: 'gluteal', sm: ['forearm', 'hip-flexors'], primaries: ['gluteal'], secondaries: ['forearm', 'hip-flexors'], + muscleGroups: ['gluteal', 'forearm', 'hip-flexors'], ...over, +}) +function seed(ex) { + useStore.setState(s => ({ S: { ...s.S, customEx: [ex] } })) + registerCustom([ex]) +} + +beforeEach(() => { + globalThis.IS_REACT_ACT_ENVIRONMENT = true + useUI.setState({ sheets: [], toastMsg: '' }) + useStore.setState({ S: structuredClone(DEF), user: null }) + registerCustom([]) + _setLangState('en', null, null, null) + document.body.innerHTML = '' +}) + +afterEach(() => { + act(() => { mounted.splice(0).forEach(root => root.unmount()) }) + _setLangState('en', null, null, null) + registerCustom([]) +}) + +describe('muscle names in the rows and tags (QA C9)', () => { + it('picker row shows the display name, not the map id', () => { + seed(custom()) + exercisePicker(vi.fn()) + const host = renderTop() + act(() => type(host.querySelector('input.input'), 'QA Custom')) + expect(rowFor(host, 'QA Custom Thrust').querySelector('.ss').textContent).toBe('Glutes · barbell') + }) + + it('config sheet tags read like the detail sheet, for a custom exercise and for power clean', () => { + seed(custom()) + exConfigSheet(EXIDX.cqa1, null, vi.fn()) + const tags = h => [...h.querySelectorAll('.tag')].map(e => e.textContent.trim()) + expect(tags(renderTop())).toEqual(['Glutes', 'barbell', 'Forearms', 'Hip flexors']) + // #207 Olympic lifts list their secondaries as map ids ('forearm', 'deltoids'). + exConfigSheet(EXIDX['0648'], null, vi.fn()) + expect(tags(renderTop())).toEqual(['hamstrings', 'barbell', 'Calves', 'Forearms', 'Shoulders']) + }) + + it('translates them in German too — "forearm" was staying English', () => { + _setLangState('de', de, null, null) + seed(custom()) + exConfigSheet(EXIDX['0648'], null, vi.fn()) + const tags = [...renderTop().querySelectorAll('.tag')].map(e => e.textContent.trim()) + expect(tags).toEqual(['Beinbeuger', 'Langhantel', 'Waden', 'Unterarme', 'Schultern']) + exercisePicker(vi.fn()) + const host = renderTop() + act(() => type(host.querySelector('input.input'), 'QA Custom')) + expect(rowFor(host, 'QA Custom Thrust').querySelector('.ss').textContent).toBe('Gesäß · Langhantel') + }) + + it('Muscles explorer row names the target the same way', () => { + seed(custom()) + const host = render() + const chip = [...host.querySelectorAll('.chip[aria-pressed]')].find(e => e.textContent.startsWith('Glutes')) + act(() => chip.click()) + act(() => type(host.querySelector('.search input'), 'QA Custom')) + expect(rowFor(host, 'QA Custom Thrust').querySelector('.ss').textContent).toBe('Primary target · Glutes · barbell') + }) +}) diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx index 89a474b..1ff1106 100644 --- a/frontend/src/views/Workout.jsx +++ b/frontend/src/views/Workout.jsx @@ -21,6 +21,7 @@ import { progressionGuidance } from '../lib/progression-copy.js' import { glyphOf } from '../lib/glyphs.js' import { isWarmupRow, isDropSet, isRestPauseSet, dropsOf, clustersOf, addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt, nextDropWeight, nextBurstReps, isSideSet, makeSideSet, setSideField, toggleSide, addSideDrop, removeSideDropAt, setSideDropAt, addSideCluster, removeSideClusterAt, setSideClusterAt } from '../lib/workout-model.js' import { canMoveActiveWorkoutUnit, moveActiveWorkoutUnit } from '../lib/active-workout-order.js' +import { MUSCLE_NAME } from '../lib/muscles.js' const SWIPE_MIN_DISTANCE = 48 const SWIPE_AXIS_RATIO = 1.25 @@ -378,7 +379,7 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie "{n} per side" chip — which halved the combined total for display — is gone: the split is no longer derived, it is what you enter. The tag only flags that this is per-side. */} {!cardio && !timed && isPerSide(cfg) && {t('Per side')}} - {(ex.tg || ex.bp) && {t(ex.tg || ex.bp)}} + {(ex.tg || ex.bp) && {t(MUSCLE_NAME[ex.tg] || ex.tg || ex.bp)}} {ex.eq && {t(ex.eq)}} {best > 0 && {t('Best:')} {fmtNum(best)} {S.unit}}
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx index 7a737e3..49b9f0f 100644 --- a/frontend/src/views/Workout.test.jsx +++ b/frontend/src/views/Workout.test.jsx @@ -1369,3 +1369,18 @@ describe('per-side effort completion', () => { expect(mocks.startRest).toHaveBeenCalledTimes(calls) }) }) + +// QA C9: custom exercises store their target as a muscle-map id ("gluteal"); the tag under the +// exercise name has to show the same label the detail sheet does (Glutes), not the raw id. +describe('Workout exercise tags', () => { + it('names a custom exercise\'s target muscle by its display name', async () => { + const { registerCustom } = await import('../lib/exercises.js') + registerCustom([{ id: 'cqa1', n: 'QA Custom Thrust', bp: 'upper legs', eq: 'barbell', custom: true, tg: 'gluteal', sm: [], primaries: ['gluteal'], secondaries: [], muscleGroups: ['gluteal'] }]) + try { + await mount([exercise('cqa1', [false])]) + const tags = [...container.querySelectorAll('.tag')].map(tag => tag.textContent.trim()) + expect(tags).toContain('Glutes') + expect(tags).not.toContain('gluteal') + } finally { registerCustom([]) } + }) +}) From 6796e559d3e502d589ad2f856869d2e8b1d6da18 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Sat, 19 Sep 2026 21:34:30 +0200 Subject: [PATCH 3/3] =?UTF-8?q?The=20cardio=20target=20keeps=20its=20trans?= =?UTF-8?q?lation=20now=20that=20it=20goes=20through=20MUSCLE=5FNAME=20?= =?UTF-8?q?=E2=80=94=20"Cardiovascular=20system"=20in=20all=2014=20packs?= =?UTF-8?q?=20(QA=20C9=20follow-up)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Routing the target through MUSCLE_NAME (2bf86a5) mapped "cardiovascular system" to the display name "Cardiovascular system", which no pack carried — only the lowercase dataset key had a translation. Every built-in cardio exercise (29 in the dataset, plus custom cardio) therefore fell back to English in the picker row, the routine config sheet and the workout tag, where the parent build already said "Herz-Kreislauf". The display name now carries the same translation each pack had for the dataset key (pt-BR inherits it from pt-PT like the other muscle names; fingerprint regenerated: 648 inherited). That also cures the Library row and the detail sheet, which mapped through MUSCLE_NAME before this branch and leaked English there all along. Regression tests: picker row + config sheet (sheets.muscle-names.test.jsx) and the workout tag (Workout.test.jsx) for burpee 1160 in German, both failing before this change. Rig check on the branch build (slot 71, de): configTags Cardio/Herz-Kreislauf/Körpergewicht, picker row "burpee — Herz-Kreislauf · Körpergewicht", workout tags identical to the config tags, Library row "Herz-Kreislauf · Körpergewicht", detail sheet Cardio/Herz-Kreislauf/Körpergewicht/… --- frontend/src/lib/pt-br-locale.test.js | 4 ++-- frontend/src/locales/de.js | 1 + frontend/src/locales/es.js | 1 + frontend/src/locales/fr.js | 1 + frontend/src/locales/hi.js | 1 + frontend/src/locales/hu.js | 1 + frontend/src/locales/it.js | 1 + frontend/src/locales/ko.js | 1 + frontend/src/locales/pl.js | 1 + frontend/src/locales/pt.js | 1 + frontend/src/locales/ru.js | 1 + frontend/src/locales/th.js | 1 + frontend/src/locales/tr.js | 1 + frontend/src/locales/zh.js | 1 + frontend/src/sheets.muscle-names.test.jsx | 14 ++++++++++++++ frontend/src/views/Workout.test.jsx | 14 ++++++++++++++ 16 files changed, 43 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js index f692c60..72a71fc 100644 --- a/frontend/src/lib/pt-br-locale.test.js +++ b/frontend/src/lib/pt-br-locale.test.js @@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => { const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex') expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(644) - expect(inherited).toHaveLength(647) + expect(inherited).toHaveLength(648) // If this fails, review the changed keys and wording before accepting a new hash. From // frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list - expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('185cca3dfbc438a4a2177956d1d18da2bbdc907281c5eb4c858ba34afaf9f38e') + expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('32e5fc261a849772b42241c352d99ecf49a4a8ec640b52379031b6654f53deb8') }) test('does not leak European Portuguese UI terms', () => { diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index fad9cba..e1fd7d5 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -504,6 +504,7 @@ export default { 'Hip flexors': 'Hüftbeuger', 'Calves': 'Waden', 'Shins': 'Schienbein', + 'Cardiovascular system': 'Herz-Kreislauf', // --- import from another app --- 'Import from another app': 'Aus anderer App importieren', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — oder Körpergewicht aus Apple Health', diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js index 68e2144..fd07819 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'Flexores de cadera', 'Calves': 'Gemelos', 'Shins': 'Tibiales', + 'Cardiovascular system': 'sistema cardiovascular', // --- import from another app --- 'Import from another app': 'Importar de otra app', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — o peso corporal de Apple Health', diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js index ff4b17c..1fab885 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'Fléchisseurs de hanche', 'Calves': 'Mollets', 'Shins': 'Tibiaux', + 'Cardiovascular system': 'système cardiovasculaire', // --- import from another app --- 'Import from another app': 'Importer depuis une autre app', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — ou le poids depuis Apple Santé', diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js index da466b3..854265f 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'हिप फ्लेक्सर', 'Calves': 'पिंडली', 'Shins': 'पिंडली की हड्डी', + 'Cardiovascular system': 'हृदय प्रणाली', // --- import from another app --- 'Import from another app': 'दूसरे ऐप से आयात करें', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — या Apple Health से वज़न', diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js index f99fa4f..fea8eb6 100644 --- a/frontend/src/locales/hu.js +++ b/frontend/src/locales/hu.js @@ -490,6 +490,7 @@ export default { 'Hip flexors': 'Csípőhajlító', 'Calves': 'Vádli', 'Shins': 'Sípcsont', + 'Cardiovascular system': 'szív-érrendszer', // --- import from another app --- 'Import from another app': 'Importálás másik appból', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — vagy testsúly az Apple Healthből', diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js index 3c8c841..99533bc 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'Flessori dell\'anca', 'Calves': 'Polpacci', 'Shins': 'Tibiali', + 'Cardiovascular system': 'sistema cardiovascolare', // --- import from another app --- 'Import from another app': 'Importa da un\'altra app', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — o il peso da Apple Salute', diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js index 48ea492..65420b2 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': '고관절 굴곡근', 'Calves': '종아리', 'Shins': '정강이', + 'Cardiovascular system': '심혈관계', // --- import from another app --- 'Import from another app': '다른 앱에서 가져오기', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — 또는 Apple 건강의 체중', diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js index 213baab..dd2a845 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'Zginacze bioder', 'Calves': 'Łydki', 'Shins': 'Piszczele', + 'Cardiovascular system': 'układ krążenia', // --- import from another app --- 'Import from another app': 'Importuj z innej aplikacji', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — albo masa ciała z Apple Health', diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js index ea44d46..22af99c 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'Flexores do quadril', 'Calves': 'Panturrilhas', 'Shins': 'Tibiais', + 'Cardiovascular system': 'sistema cardiovascular', // --- import from another app --- 'Import from another app': 'Importar de outra app', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — ou o peso da Apple Saúde', diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js index 46ce8ef..6e60694 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'Сгибатели бедра', 'Calves': 'Икры', 'Shins': 'Голени', + 'Cardiovascular system': 'сердечно-сосудистая система', // --- import from another app --- 'Import from another app': 'Импорт из другого приложения', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — или вес из Apple Health', diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js index f2b372d..d75ff9a 100644 --- a/frontend/src/locales/th.js +++ b/frontend/src/locales/th.js @@ -490,6 +490,7 @@ export default { 'Hip flexors': 'กล้ามเนื้องอสะโพก', 'Calves': 'น่อง', 'Shins': 'หน้าแข้ง', + 'Cardiovascular system': 'ระบบหัวใจและหลอดเลือด', // --- import from another app --- 'Import from another app': 'นำเข้าจากแอปอื่น', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — หรือน้ำหนักตัวจาก Apple Health', diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js index 95720d1..61ae963 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': 'Kalça fleksörleri', 'Calves': 'Baldırlar', 'Shins': 'İncik', + 'Cardiovascular system': 'kalp-damar sistemi', // --- import from another app --- 'Import from another app': 'Başka uygulamadan içe aktar', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes, Strong, Hevy — veya Apple Health\'ten vücut ağırlığı', diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js index f45110e..241528a 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -485,6 +485,7 @@ export default { 'Hip flexors': '髋屈肌', 'Calves': '小腿', 'Shins': '胫前肌', + 'Cardiovascular system': '心血管系统', // --- import from another app --- 'Import from another app': '从其他应用导入', 'FitNotes, Strong, Hevy — or body weight from Apple Health': 'FitNotes、Strong、Hevy — 或来自 Apple 健康的体重', diff --git a/frontend/src/sheets.muscle-names.test.jsx b/frontend/src/sheets.muscle-names.test.jsx index fdb3c9a..10a5537 100644 --- a/frontend/src/sheets.muscle-names.test.jsx +++ b/frontend/src/sheets.muscle-names.test.jsx @@ -96,6 +96,20 @@ describe('muscle names in the rows and tags (QA C9)', () => { expect(rowFor(host, 'QA Custom Thrust').querySelector('.ss').textContent).toBe('Gesäß · Langhantel') }) + // The dataset's cardio target "cardiovascular system" is both a map id and a translated key + // of its own. Routing it through MUSCLE_NAME must not cost it its translation: the 29 + // built-in cardio exercises read "Herz-Kreislauf" in German, never "Cardiovascular system". + it('keeps the cardio target translated (burpee, de)', () => { + _setLangState('de', de, null, null) + exercisePicker(vi.fn()) + const host = renderTop() + act(() => type(host.querySelector('input.input'), 'burpee')) + expect(rowFor(host, 'burpee').querySelector('.ss').textContent).toBe('Herz-Kreislauf · Körpergewicht') + exConfigSheet(EXIDX['1160'], null, vi.fn()) + const tags = [...renderTop().querySelectorAll('.tag')].map(e => e.textContent.trim()) + expect(tags).toEqual(['Cardio', 'Herz-Kreislauf', 'Körpergewicht']) + }) + it('Muscles explorer row names the target the same way', () => { seed(custom()) const host = render() diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx index 49b9f0f..c58ceee 100644 --- a/frontend/src/views/Workout.test.jsx +++ b/frontend/src/views/Workout.test.jsx @@ -1383,4 +1383,18 @@ describe('Workout exercise tags', () => { expect(tags).not.toContain('gluteal') } finally { registerCustom([]) } }) + + // The cardio target "cardiovascular system" is a translated key of its own; mapping it through + // MUSCLE_NAME must not turn "Herz-Kreislauf" back into English for every built-in cardio exercise. + it('keeps the cardio target translated (burpee, de)', async () => { + const { _setLangState } = await import('../lib/i18n-core.js') + const { default: de } = await import('../locales/de.js') + _setLangState('de', de, null, null) + try { + await mount([exercise('1160', [false])]) + const tags = [...container.querySelectorAll('.tag')].map(tag => tag.textContent.trim()) + expect(tags).toContain('Herz-Kreislauf') + expect(tags).not.toContain('Cardiovascular system') + } finally { _setLangState('en', null, null, null) } + }) })