Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Exercise names: Portuguese (Brazil), Hungarian, Spanish, Russian, Italian and French names are title-cased again in lists, cards, history, the printout and a copied workout, while German keeps its own casing (#290)

Duarte Santos81b9f77ccebf
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 3414feff1..3de9d07f8 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1124,8 +1124,10 @@ body.chips-dragging *{cursor:inherit}
#timer.working{border:var(--hair) solid var(--acc)}
#timer.working .t{color:var(--acc)}
#timer.working .grow{flex:1;min-width:0}
+/* The label is the exercise name, handed in already cased (exerciseNameText): a capitalize here
+ would title-case German's own casing too. */
#timer.working .lbl{
- font-size:12px;color:var(--label-2);margin-bottom:5px;text-transform:capitalize;
+ font-size:12px;color:var(--label-2);margin-bottom:5px;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
diff --git a/frontend/src/lib/format-names.test.js b/frontend/src/lib/format-names.test.js
new file mode 100644
index 000000000..d9305b1e5
--- /dev/null
+++ b/frontend/src/lib/format-names.test.js
@@ -0,0 +1,29 @@
+import { afterEach, describe, expect, it } from 'vitest'
+import { exerciseNameText } from './format.js'
+import { _setLangState } from './i18n-core.js'
+import de from '../exercise-names/de.js'
+import es from '../exercise-names/es.js'
+
+// A toast, a dialog title, the timed-set label and the Stats picker show an exercise name as
+// plain text, with no element to carry the CSS title-casing. They have to come out cased the way
+// the same name reads in the list next to them.
+describe('exerciseNameText', () => {
+ const bench = { id: '0025', n: 'barbell bench press' }
+ const custom = { id: 'custom-1', n: 'my own press' }
+ afterEach(() => _setLangState('en', {}, null, null))
+
+ it('title-cases an English name and a custom one', () => {
+ expect(exerciseNameText(bench)).toBe('Barbell Bench Press')
+ expect(exerciseNameText(custom)).toBe('My Own Press')
+ })
+
+ it('title-cases a name from a lower-case pack, the English one in parentheses included', () => {
+ _setLangState('es', {}, null, es)
+ expect(exerciseNameText(bench)).toBe('Press De Banca Con Barra (Barbell Bench Press)')
+ })
+
+ it('leaves German as the pack writes it', () => {
+ _setLangState('de', {}, null, de, false)
+ expect(exerciseNameText(bench)).toBe('Bankdrücken mit Langhantel')
+ })
+})
diff --git a/frontend/src/lib/format.js b/frontend/src/lib/format.js
index af34cb3b4..7975337f0 100644
--- a/frontend/src/lib/format.js
+++ b/frontend/src/lib/format.js
@@ -1,5 +1,5 @@
// Formatting + date helpers (ported from the vanilla app, unit taken from the store where needed).
-import { dateLocale, t } from './i18n-core.js'
+import { dateLocale, t, exerciseNameFor, exerciseNameClass } from './i18n-core.js'
export const todayISO = () => {
const d = new Date()
return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0')
@@ -30,6 +30,10 @@ export const durPart = ms => (ms >= 60000 ? [fmtDur(ms)] : [])
// Exercise names are stored lower-case and shown through CSS `capitalize`; text that has no
// element of its own (a toast) capitalises here instead.
export const capWords = s => String(s || '').replace(/(^|[\s(\-\/])(\p{Ll})/gu, (m, pre, ch) => pre + ch.toUpperCase())
+// An exercise's display name as plain text, cased the way its element would be on screen
+// (exerciseNameClass): for a toast, a dialog title or a picker label, which have no element of
+// their own to put the class on.
+export const exerciseNameText = ex => (exerciseNameClass(ex) ? capWords(exerciseNameFor(ex)) : exerciseNameFor(ex))
/* How many decimals a weight is shown with. One is enough for plate-loadable numbers, but a
* per-side figure from kg plates lands on .25 and .75 and reading those as .3 and .8 is the
* complaint in issue #139 — as is microplate work. The setting is read here rather than passed
diff --git a/frontend/src/lib/i18n-core.js b/frontend/src/lib/i18n-core.js
index 0e0358647..63b7fe0dc 100644
--- a/frontend/src/lib/i18n-core.js
+++ b/frontend/src/lib/i18n-core.js
@@ -98,18 +98,26 @@ export const exerciseNameFor = ex => {
: `${translated} (${ex.n})`
}
-// EXDB stores English names lower-case and the UI title-cases them with CSS. A translated pack
-// carries its own casing and must not be cased again on top: German lower-cases adjectives
-// ("Assistiertes hängendes Knieheben"), Hungarian lower-cases common nouns. So the class that
-// does the title-casing belongs on the element only while the English fallback is showing.
-// That is decided per exercise, not per language: German covers only part of the catalogue,
-// and an exercise it has no entry for shows its lower-case English title, which still needs
-// the casing ("push-up" would otherwise sit between "Bankdrücken" and "Kniebeuge"). A custom
+// Exercise-name packs written in the language's own casing. German capitalises its nouns and
+// lower-cases the adjectives in front of them ("Assistiertes hängendes Knieheben"), which
+// title-casing on top would undo. Every other pack is stored lower-case, the way EXDB stores
+// the English names ("supino com barra"). Left without the title-casing English gets, those
+// read all lower-case in every list, card and history row. A new pack goes here only when it
+// carries real casing; i18n-core.test.js checks this list against the packs themselves.
+export const CASED_NAME_LANGS = ['de']
+
+// EXDB stores English names lower-case and the UI title-cases them with CSS. A pack in
+// CASED_NAME_LANGS carries its own casing and must not be cased again on top, so the class that
+// does the title-casing stays off its translated names. A lower-case pack is title-cased like
+// English. That is decided per exercise, not only per language: German covers only part of the
+// catalogue, and an exercise it has no entry for shows its lower-case English title, which still
+// needs the casing ("push-up" would otherwise sit between "Bankdrücken" and "Kniebeuge"). A custom
// exercise has no pack entry either and keeps the casing it always had, and so does every
// exercise while "English names only" is on, since exerciseNameFor then shows the English title.
// Callers spread this onto the element that holds exerciseNameFor(ex)'s output, nothing else —
// muscle and equipment labels next to it are t() strings and keep their own capitalize.
-export const exerciseNameClass = ex => (!enOnly && exerciseNames && ex && exerciseNames[ex.id] ? '' : 'capitalize')
+export const exerciseNameClass = ex => (!enOnly && exerciseNames && ex && exerciseNames[ex.id]
+ && CASED_NAME_LANGS.includes(baseLang(lang)) ? '' : 'capitalize')
// Search both the localized and canonical English title without changing persisted data.
export const exerciseNameSearchText = ex => {
diff --git a/frontend/src/lib/i18n-core.test.js b/frontend/src/lib/i18n-core.test.js
index 7e432e110..ef68e9f94 100644
--- a/frontend/src/lib/i18n-core.test.js
+++ b/frontend/src/lib/i18n-core.test.js
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest'
import {
LANGS, INSTR_LANGS, EXERCISE_NAME_LANGS, DATE_LOCALES, DERIVED_LOCALES,
- baseLang, derivePack, dateLocale, getLang, t, _setLangState, exerciseNameClass, exerciseNameFor
+ baseLang, derivePack, dateLocale, getLang, t, _setLangState, exerciseNameClass, exerciseNameFor, CASED_NAME_LANGS
} from './i18n-core.js'
import { EXDB } from './exercises-data.js'
import de from '../locales/de.js'
@@ -101,9 +101,9 @@ describe('de-CH as a selectable language', () => {
})
})
-// EXDB stores English names lower-case and the UI title-cases them with CSS. A translated pack
-// brings its own casing, and applying capitalize on top of it produced "Bankdrücken Mit
-// Langhantel" in German and "Has" for Hungarian common nouns.
+// EXDB stores English names lower-case and the UI title-cases them with CSS. German brings its
+// own casing, and applying capitalize on top of it produced "Bankdrücken Mit Langhantel". The
+// other packs are stored lower-case like EXDB, and without the class they read all lower-case.
describe('exerciseNameClass', () => {
const bench = { id: '0025', n: 'barbell bench press' }
const pushUp = { id: '0662', n: 'push-up' }
@@ -132,6 +132,44 @@ describe('exerciseNameClass', () => {
})
})
+// #290 took the title-casing off every translated name so German would keep its own, and the
+// packs stored lower-case (pt-BR, hu, es, ru, it, fr) went lower-case everywhere with it. Which
+// packs carry real casing is a list, so it is checked against what the packs actually hold: a
+// new pack that is lower-case gets the casing without anyone remembering to add it, and one with
+// real casing fails here until it is listed.
+describe('title-casing per exercise-name pack', () => {
+ const packs = import.meta.glob('../exercise-names/*.js', { eager: true, import: 'default' })
+ const packFor = lang => packs[`../exercise-names/${lang}.js`]
+ // Share of names that start with a lower-case letter. A lower-case pack still has a few that
+ // start upper-case for a reason of their own (EZ-rudas, L-sit, SkiErg), German has none.
+ const lowerShare = names => {
+ const firsts = Object.values(names).map(n => [...n][0]).filter(c => c && c.toLocaleLowerCase() !== c.toLocaleUpperCase())
+ return firsts.filter(c => c === c.toLocaleLowerCase()).length / firsts.length
+ }
+
+ it('lists exactly the packs written in their own casing', () => {
+ for (const lang of EXERCISE_NAME_LANGS) {
+ expect(CASED_NAME_LANGS.includes(lang), `${lang}: ${Math.round(lowerShare(packFor(lang)) * 100)}% lower-case`)
+ .toBe(lowerShare(packFor(lang)) < 0.5)
+ }
+ for (const lang of CASED_NAME_LANGS) expect(EXERCISE_NAME_LANGS, lang).toContain(lang)
+ })
+
+ for (const lang of [...EXERCISE_NAME_LANGS, 'de-CH']) {
+ const cased = CASED_NAME_LANGS.includes(baseLang(lang))
+ it(`${lang}: a translated name is ${cased ? 'left in its own casing' : 'title-cased like English'}`, () => {
+ const names = packFor(baseLang(lang))
+ const translated = EXDB.filter(e => names[e.id])
+ _setLangState(lang, {}, null, names)
+ for (const ex of translated) expect(exerciseNameClass(ex), `${lang} ${ex.id}`).toBe(cased ? '' : 'capitalize')
+ // An exercise the pack does not cover shows the lower-case English title either way.
+ const untranslated = EXDB.find(e => !names[e.id])
+ if (untranslated) expect(exerciseNameClass(untranslated)).toBe('capitalize')
+ _setLangState('en', {}, null, null)
+ })
+ }
+})
+
// The two per-language switches in Settings (the English name in parentheses, English names
// only) came with the Italian and French packs, but they have to hold for every pack the app
// ships — German too, which covers only part of the catalogue.
@@ -149,11 +187,13 @@ describe('English-name switches with every exercise-name pack', () => {
const ex = EXDB.find(e => names[e.id] && names[e.id].toLocaleLowerCase(lang) !== e.n.toLocaleLowerCase('en'))
expect(ex, lang).toBeTruthy()
_setLangState(lang, {}, null, names)
+ // German keeps its own casing; a lower-case pack is title-cased like English.
+ const translatedClass = CASED_NAME_LANGS.includes(lang) ? '' : 'capitalize'
expect(exerciseNameFor(ex)).toBe(`${names[ex.id]} (${ex.n})`)
- expect(exerciseNameClass(ex)).toBe('')
+ expect(exerciseNameClass(ex)).toBe(translatedClass)
_setLangState(lang, {}, null, names, false)
expect(exerciseNameFor(ex)).toBe(names[ex.id])
- expect(exerciseNameClass(ex)).toBe('')
+ expect(exerciseNameClass(ex)).toBe(translatedClass)
_setLangState(lang, {}, null, names, true, true)
expect(exerciseNameFor(ex)).toBe(ex.n)
// The English title is stored lower-case, so it gets the title-casing back with it.
diff --git a/frontend/src/lib/plan-print.test.js b/frontend/src/lib/plan-print.test.js
index 1429a44e1..b4ba73036 100644
--- a/frontend/src/lib/plan-print.test.js
+++ b/frontend/src/lib/plan-print.test.js
@@ -1,6 +1,7 @@
// The printable plan (#149) and one routine on its own page (#282).
-import { describe, it, expect } from 'vitest'
+import { afterEach, describe, it, expect } from 'vitest'
import { planPrintHTML } from './plan-share.js'
+import { CASED_NAME_LANGS, EXERCISE_NAME_LANGS, _setLangState } from './i18n-core.js'
const S = {
unit: 'kg',
@@ -51,3 +52,20 @@ describe('planPrintHTML', () => {
expect(body).not.toContain('Push day')
})
})
+
+// The printout title-cases a name with the same class the screen uses (exerciseNameClass): the
+// lower-case packs get it back, German keeps its own casing.
+describe('planPrintHTML exercise-name casing per language', () => {
+ const packs = import.meta.glob('../exercise-names/*.js', { eager: true, import: 'default' })
+ const nameClass = html => html.match(/<div class="ex-n ([^"]*)">/)?.[1].trim()
+ afterEach(() => _setLangState('en', {}, null, null))
+
+ for (const lang of EXERCISE_NAME_LANGS) {
+ it(`${lang}: ${CASED_NAME_LANGS.includes(lang) ? 'no title-casing on the translated name' : 'the translated name is title-cased'}`, () => {
+ _setLangState(lang, {}, null, packs[`../exercise-names/${lang}.js`])
+ const html = planPrintHTML(S, 'Ana', { routineId: 'pull' })
+ expect(nameClass(html)).toBe(CASED_NAME_LANGS.includes(lang) ? '' : 'capitalize')
+ expect(html).toContain('.ex-n.capitalize { text-transform: capitalize; }')
+ })
+ }
+})
diff --git a/frontend/src/lib/workout-text.test.js b/frontend/src/lib/workout-text.test.js
index a09cc4a4d..0babdde28 100644
--- a/frontend/src/lib/workout-text.test.js
+++ b/frontend/src/lib/workout-text.test.js
@@ -1,6 +1,8 @@
-import { describe, expect, it } from 'vitest'
+import { afterEach, describe, expect, it } from 'vitest'
import { workoutText } from './workout-text.js'
import { fmtDate } from './format.js'
+import { EXIDX } from './exercises.js'
+import { EXERCISE_NAME_LANGS, _setLangState, exerciseNameFor } from './i18n-core.js'
// Discord 'Improvement ideas': a past workout copied as plain text to paste anywhere.
describe('workoutText', () => {
@@ -88,3 +90,26 @@ describe('workoutText speed unit', () => {
expect(workoutText(w, { unit: 'kg', nameOf }).split('\n').at(-1)).toBe('20 min @ 16.1 km/h')
})
})
+
+// Copy as text has no CSS to title-case with, so it capitalises itself wherever the screen does
+// (exerciseNameClass): every translated pack stored lower-case, and not German's own casing.
+describe('workoutText exercise names per language', () => {
+ const packs = import.meta.glob('../exercise-names/*.js', { eager: true, import: 'default' })
+ const w = { id: 'w2', d: '2026-09-03', start: 0, end: 0, name: 'Push', vol: 0,
+ entries: [{ id: '0025', target: { mode: 'reps' }, sets: [{ w: 60, r: 8, done: true }] }] }
+ const nameLine = () => workoutText(w, { unit: 'kg', nameOf: e => exerciseNameFor(EXIDX[e.id]) }).split('\n\n')[1].split('\n')[0]
+ afterEach(() => _setLangState('en', {}, null, null))
+
+ it('keeps German as the pack writes it and title-cases the lower-case packs', () => {
+ const expected = {
+ de: 'Bankdrücken mit Langhantel', es: 'Press De Banca Con Barra', fr: 'Développé Couché À La Barre',
+ it: 'Panca Piana Con Bilanciere', 'pt-BR': 'Supino Com Barra', ru: 'Жим Штанги Лёжа', hu: 'Fekvenyomás Rúddal',
+ }
+ for (const lang of EXERCISE_NAME_LANGS) {
+ _setLangState(lang, {}, null, packs[`../exercise-names/${lang}.js`], false)
+ expect(nameLine(), lang).toBe(expected[lang])
+ }
+ _setLangState('en', {}, null, null)
+ expect(nameLine()).toBe('Barbell Bench Press')
+ })
+})
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index dbf65a836..bf284b595 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -3,7 +3,7 @@ import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf, searchExercises, exOr, isAssisted, betterWeight, beatsWeight } from './lib/exercises.js'
import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js'
-import { fmtDate, fmtNum, fmtPlate, capWords, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, routineCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js'
+import { fmtDate, fmtNum, fmtPlate, exerciseNameText, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, routineCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js'
import { lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, effectiveRoutineIds, workoutDay, workoutVolume, setsDone, setsDoneActive, setUnitsTotal, lastBW, supersetUnits, sessionSections, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, EFFORT, capEffort, stepEffort, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'
import { usesBar, defaultBarWeight, hasBarOverride, isNoBar } from './lib/bar.js'
import { PLATE_SIZES, pairsOf, ownsPlates, withPlatePairs, withStandardPlates, withLoadKind, loadKindFor, baseWeightFor } from './lib/plates.js'
@@ -887,7 +887,7 @@ function AddToRoutine({ ex, close }) {
if (r) r.ex.push({ id: ex.id, ...cfg })
})
const r = isNew ? S().routines[S().routines.length - 1] : st.routines.find(x => x.id === rid)
- toast(t('“{0}” added to {1}', exerciseNameClass(ex) ? capWords(exerciseNameFor(ex)) : exerciseNameFor(ex), r ? r.name : t('routine')))
+ toast(t('“{0}” added to {1}', exerciseNameText(ex), r ? r.name : t('routine')))
if (isNew && r) nav('/plan/r/' + r.id)
}, null, isNew ? null : st.routines.find(x => x.id === rid))
}
diff --git a/frontend/src/views/Library.test.jsx b/frontend/src/views/Library.test.jsx
index 7c5cf3ba7..35e651ed6 100644
--- a/frontend/src/views/Library.test.jsx
+++ b/frontend/src/views/Library.test.jsx
@@ -8,6 +8,7 @@ import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import Library from './Library.jsx'
import { EXDB } from '../lib/exercises.js'
+import { CASED_NAME_LANGS, EXERCISE_NAME_LANGS, _setLangState } from '../lib/i18n-core.js'
globalThis.IS_REACT_ACT_ENVIRONMENT = true
@@ -84,3 +85,22 @@ describe('Library favourites', () => {
expect(shown).not.toContain(legs.n)
})
})
+
+// #290 took the title-casing off every translated name; the packs stored lower-case then read
+// lower-case down the whole list. Only German's own casing is left alone.
+describe('Library exercise-name casing per language', () => {
+ const packs = import.meta.glob('../exercise-names/*.js', { eager: true, import: 'default' })
+ afterEach(() => _setLangState('en', {}, null, null))
+
+ for (const lang of EXERCISE_NAME_LANGS) {
+ it(`${lang}: every translated row is ${CASED_NAME_LANGS.includes(lang) ? 'left in its own casing' : 'title-cased'}`, () => {
+ const pack = packs[`../exercise-names/${lang}.js`]
+ _setLangState(lang, {}, null, pack)
+ const rows = [...render().querySelectorAll('.item .tt')].slice(1) // drop "Create your own"
+ expect(rows.length).toBeGreaterThan(0)
+ const translated = rows.filter(el => Object.values(pack).some(n => el.textContent.startsWith(n)))
+ expect(translated.length, lang).toBeGreaterThan(0)
+ for (const el of translated) expect(el.classList.contains('capitalize'), `${lang}: ${el.textContent}`).toBe(!CASED_NAME_LANGS.includes(lang))
+ })
+ }
+})
diff --git a/frontend/src/views/RoutineEdit.jsx b/frontend/src/views/RoutineEdit.jsx
index 3a560db1d..8d82a7715 100644
--- a/frontend/src/views/RoutineEdit.jsx
+++ b/frontend/src/views/RoutineEdit.jsx
@@ -4,7 +4,7 @@ import { useStore } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { exOr } from '../lib/exercises.js'
import { activeProfile, exAvailable } from '../lib/equipment.js'
-import { uid, capWords } from '../lib/format.js'
+import { uid, exerciseNameText } from '../lib/format.js'
import { t, exerciseNameFor, exerciseNameClass } from '../lib/i18n.js'
import { supersetUnits, moveSupersetUnit, cleanupSg, exLine, defaultConfig } from '../lib/history.js'
import { Thumb } from '../components/Media.jsx'
@@ -353,7 +353,7 @@ export default function RoutineEdit() {
picker.close()
let done = false
edit(x => { if (x[i] && x[i].id === openedOn) { x[i] = fn(x[i]); done = true } })
- if (done) toast(t('Replaced with “{0}”', exerciseNameClass(ex) ? capWords(exerciseNameFor(ex)) : exerciseNameFor(ex)))
+ if (done) toast(t('Replaced with “{0}”', exerciseNameText(ex)))
}
const picker = exercisePicker((ex, quick) => {
// The slot and the history as they are now, not as this render saw them: a sync can land
@@ -490,7 +490,7 @@ export default function RoutineEdit() {
<Button variant="primary" onClick={() => exercisePicker((ex, quick) => {
if (quick) {
edit(x => x.push({ id: ex.id, ...defaultConfig(ex.id) }))
- toast(t('“{0}” added to {1}', exerciseNameFor(ex), r.name))
+ toast(t('“{0}” added to {1}', exerciseNameText(ex), r.name))
} else {
exConfigSheet(ex, null, cfg => edit(x => { x.push({ id: ex.id, ...cfg }) }), null, r)
}
diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx
index 79012e927..d96d0ab47 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -3,9 +3,9 @@ import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
import { EXIDX, matchExercise, betterWeight } from '../lib/exercises.js'
import { lastBW, streakWeeks, setLabel, modeOf, effortOf, entriesForExercise, metricEntriesForExercise, metricModeForEntry, bestWeightForEntry, completedRepsOf, workoutDay } from '../lib/history.js'
-import { fmtNum, fmtDate, fmtVol, todayISO, weekStartOf } from '../lib/format.js'
+import { fmtNum, fmtDate, fmtVol, todayISO, weekStartOf, exerciseNameText } from '../lib/format.js'
import { speedUnitOf, speedLabel, toSpeed } from '../lib/speed.js'
-import { t, exerciseNameFor, getLang } from '../lib/i18n.js'
+import { t, exerciseNameFor, exerciseNameClass, getLang } from '../lib/i18n.js'
import { bwSheet, goalSheet, calendarSheet, workoutDetailSheet, exerciseHistorySheet, WorkoutRow, bwDeltaColor, weighInsSheet } from '../sheets.jsx'
import LineChart from '../components/LineChart.jsx'
import Heatmap from '../components/Heatmap.jsx'
@@ -196,7 +196,7 @@ function MuscleBalance({ S }) {
<div key={row.id} className="mrow" style={{ minHeight: 48, alignItems: 'stretch', cursor: 'pointer' }} {...tappable(() => exerciseHistorySheet(row.id))}>
<span className="nm" style={{ whiteSpace: 'normal', lineHeight: 1.35, display: 'flex', flexDirection: 'column', justifyContent: 'center' }}>
<span style={{ display: 'block', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
- {row.name}
+ <span className={EXIDX[row.id] ? exerciseNameClass(EXIDX[row.id]) : undefined}>{row.name}</span>
{row.primary === sel
? <span className="dim" style={{ fontSize: 11, marginInlineStart: 6 }}>{t('primary')}</span>
: <span className="dim" style={{ fontSize: 11, marginInlineStart: 6 }}>{t('secondary')}</span>}
@@ -502,7 +502,7 @@ export default function Stats() {
{exHist.length ? <>
<div className="sect-b" style={{ marginBottom: 10 }}>
<SelectRow title={t('Exercise')} sheetTitle={t('Exercise progress')} value={curEx} onChange={setExId} stackedValue
- options={exHist.map(id => ({ value: id, label: nameOf(id) + (exCurrent[id].mx ? ' ' + '—' + ' ' + fmtNum(exCurrent[id].mx) + ' ' + exCurrent[id].unit : '') }))}
+ options={exHist.map(id => ({ value: id, label: (EXIDX[id] ? exerciseNameText(EXIDX[id]) : nameOf(id)) + (exCurrent[id].mx ? ' ' + '—' + ' ' + fmtNum(exCurrent[id].mx) + ' ' + exCurrent[id].unit : '') }))}
search={{
placeholder: t('Search…'),
label: t('Search…'),
diff --git a/frontend/src/views/Stats.recovery.test.jsx b/frontend/src/views/Stats.recovery.test.jsx
index 50f20950a..0e260032c 100644
--- a/frontend/src/views/Stats.recovery.test.jsx
+++ b/frontend/src/views/Stats.recovery.test.jsx
@@ -493,13 +493,15 @@ describe('Stats exercise progress picker', () => {
await click(modal.querySelector('button[aria-label="Clear"]'))
await setSearch('squat full bárbell')
- expect(modal.textContent).toContain('barbell full squat')
- expect(modal.textContent).not.toContain('barbell bench press')
+ // A catalogue name is title-cased like it is in every list (exerciseNameText); the legacy
+ // snapshot above keeps the name as it was typed.
+ expect(modal.textContent).toContain('Barbell Full Squat')
+ expect(modal.textContent).not.toContain('Barbell Bench Press')
- const matching = [...modal.querySelectorAll('button')].find(button => button.textContent.includes('barbell full squat'))
+ const matching = [...modal.querySelectorAll('button')].find(button => button.textContent.includes('Barbell Full Squat'))
await click(matching)
expect(useUI.getState().sheets).toHaveLength(0)
- expect(card.querySelector('.lrow-v').textContent).toContain('barbell full squat')
+ expect(card.querySelector('.lrow-v').textContent).toContain('Barbell Full Squat')
})
})
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index a0e309742..9510af694 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -8,7 +8,7 @@ import { exOr, betterWeight } from '../lib/exercises.js'
import { usesBar } from '../lib/bar.js'
import { loadKindFor, baseWeightFor, inventoryFor, rowLoad, sameLoad, plateDelta } from '../lib/plates.js'
import { effectiveRoutines, effectiveRoutineIds, lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, freestyleConfig, defaultConfig, setsDoneActive, setUnitsTotal, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor, setsRepsOf } from '../lib/history.js'
-import { fmtNum, fmtPlate, capWords, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
+import { fmtNum, fmtPlate, exerciseNameText, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
import { speedUnitOf, toSpeed, fromSpeed } from '../lib/speed.js'
import { beep, vibrate, unlock } from '../lib/sound.js'
import { t, exerciseNameFor, exerciseNameClass } from '../lib/i18n.js'
@@ -996,7 +996,7 @@ function ActiveWorkout() {
if (!e) return
const hasDone = (e.sets || []).some(s => s.done)
confirmSheet({
- title: t('Remove {0}?', exerciseNameFor(exOr(e.id))),
+ title: t('Remove {0}?', exerciseNameText(exOr(e.id))),
message: hasDone
? t('The sets you logged for this exercise in this session will be lost.')
: t('This removes the exercise from your current session.'),
@@ -1011,7 +1011,7 @@ function ActiveWorkout() {
<div className="muted small" style={{ marginBottom: 12 }}>{t('Which exercise in this superset do you want to remove?')}</div>
<div className="list">
{unit.map(idx => <div key={idx} className="item" onClick={() => { close(); confirmRemoveExercise(idx) }}>
- <div className="grow"><div className="tt">{exerciseNameFor(exOr(A.entries[idx]?.id))}</div></div>
+ <div className="grow"><div className={`tt ${exerciseNameClass(exOr(A.entries[idx]?.id))}`}>{exerciseNameFor(exOr(A.entries[idx]?.id))}</div></div>
<Icon name="chevronRight" />
</div>)}
</div>
@@ -1037,7 +1037,7 @@ function ActiveWorkout() {
// the row is held to the end, ticked, or given a duration you typed yourself, and it never
// reaches S.workouts (lib/finish-workout.js).
const plan = (!e.sets[i].done && e.sets[i].planSec) || e.sets[i].sec || 45
- useUI.getState().startWork(plan, exerciseNameFor(exOr(e.id)), (elapsed, { abandoned = false, chimed = false } = {}) => {
+ useUI.getState().startWork(plan, exerciseNameText(exOr(e.id)), (elapsed, { abandoned = false, chimed = false } = {}) => {
// A hold a rest displaced (useUI.abandonWork: a set ticked on another row, or another
// exercise) keeps its seconds and nothing else. It is not a finish: the row stays unticked
// and starts no rest, because the rest that displaced the hold is already counting down —
@@ -1381,7 +1381,7 @@ function ActiveWorkout() {
// button. Quick-add commits with the same default (or, freestyle, last-session) config
// the sheet would have opened with; tapping the row still opens that sheet for anyone
// who wants to set sets/reps first.
- if (quick) { commit(seed || defaultConfig(ex.id)); useUI.getState().toast(t('“{0}” added to {1}', exerciseNameClass(ex) ? capWords(exerciseNameFor(ex)) : exerciseNameFor(ex), routine ? routine.name : t('Freestyle'))) }
+ if (quick) { commit(seed || defaultConfig(ex.id)); useUI.getState().toast(t('“{0}” added to {1}', exerciseNameText(ex), routine ? routine.name : t('Freestyle'))) }
else exConfigSheet(ex, null, commit, null, routine, seed)
})} icon="plus">{t('Add exercise')}</Button>
{wc.exerciseButtons && A.entries.length > 0 && <>