From 10ff64b0e1cce1b6f769f980cfc8534aa5918323 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Sat, 19 Sep 2026 21:15:33 +0200 Subject: [PATCH] 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. --- frontend/src/lib/muscles.js | 6 ++++-- frontend/src/lib/muscles.test.js | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) 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([]) + } + }) +})