diff --git a/frontend/src/lib/muscles.js b/frontend/src/lib/muscles.js index eb913e1..92a96c5 100644 --- a/frontend/src/lib/muscles.js +++ b/frontend/src/lib/muscles.js @@ -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. diff --git a/frontend/src/lib/muscles.test.js b/frontend/src/lib/muscles.test.js index 9294ac7..e0f29f0 100644 --- a/frontend/src/lib/muscles.test.js +++ b/frontend/src/lib/muscles.test.js @@ -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([]) + } + }) +})