Library: cardio exercises show a translated "cardiovascular system" instead of English in every language (QA copy)

MUSCLE_NAME values are the i18n keys, but the cardio pseudo-muscle was written as
"Cardiovascular system" while the packs only know the dataset's lowercase spelling, so the
Library row subtitle and the exercise sheet's target tag stayed English in all 13 translated
languages. Both places capitalise with CSS anyway, so the key now matches the packs and the
English rendering is unchanged. A test checks every MUSCLE_NAME value against every pack so
the next name added here cannot silently render English.
This commit is contained in:
Duarte Santos committed 2026-09-19 21:15:33 +02:00
1 parent d0c7d40a68
commit 10ff64b0e1
2 files changed
+18 -2

No files matched your search

+4 -2
View File
@@ -31,13 +31,15 @@ export const inMuscleOrder = list => {
// Drawn as the silhouette, never shaded: they carry no training load.
export const INERT = ['head', 'hair', 'neck', 'hands', 'feet', 'knees', 'ankles']
// English display names; these strings are the i18n keys (see lib/i18n.js).
// English display names; these strings are the i18n keys (see lib/i18n.js). The packs know
// the cardio pseudo-muscle only under the dataset's own lowercase spelling, and every place
// that shows it capitalises with CSS — a capitalised key here rendered English everywhere.
export const MUSCLE_NAME = {
trapezius: 'Traps', deltoids: 'Shoulders', chest: 'Chest', 'upper-back': 'Upper back',
serratus: 'Serratus', biceps: 'Biceps', triceps: 'Triceps', forearm: 'Forearms',
abs: 'Abs', obliques: 'Obliques', 'lower-back': 'Lower back', gluteal: 'Glutes',
quadriceps: 'Quads', hamstring: 'Hamstrings', adductors: 'Adductors',
'hip-flexors': 'Hip flexors', calves: 'Calves', tibialis: 'Shins', 'cardiovascular system': 'Cardiovascular system',
'hip-flexors': 'Hip flexors', calves: 'Calves', tibialis: 'Shins', 'cardiovascular system': 'cardiovascular system',
}
// Every spelling that occurs in the dataset's `tg` and `sm` fields. null = not drawable.
+14
View File
@@ -210,3 +210,17 @@ describe('muscle balance windows and ranking', () => {
expect(loadOfWorkouts([{ entries: [deleted] }])).toEqual({ chest: 1 })
})
})
// MUSCLE_NAME values are the i18n keys — a value no pack defines renders English in every
// language. The Library list showed "Cardiovascular system" untranslated for every cardio
// exercise (QA copy): the packs only ever had the dataset's own lowercase spelling.
describe('MUSCLE_NAME as i18n keys', () => {
const packs = import.meta.glob('../locales/*.js', { eager: true })
it('every display name is a key in every locale pack', () => {
expect(Object.keys(packs).length).toBe(14)
for (const [file, mod] of Object.entries(packs)) {
const missing = Object.values(MUSCLE_NAME).filter(name => !(name in mod.default))
expect(missing, file).toEqual([])
}
})
})