diff --git a/frontend/src/lib/format.js b/frontend/src/lib/format.js index 374d540..3817119 100644 --- a/frontend/src/lib/format.js +++ b/frontend/src/lib/format.js @@ -36,6 +36,7 @@ export const fmtNum = n => (Math.round(n * 10) / 10).toLocaleString(dateLocale() export const fmtVol = (v, unit) => fmtNum(v) + ' ' + unit // Plural forms are not automatic when the English string is the key. export const exCount = n => t(n === 1 ? '{0} exercise' : '{0} exercises', n) +export const routineCount = n => t(n === 1 ? '{0} routine' : '{0} routines', n) /* ---------------------------------------------------------------- week start -- Where a week begins is a local convention, not a fact: most of Europe starts on 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([]) + } + }) +}) diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js index f692c60..42c163a 100644 --- a/frontend/src/lib/pt-br-locale.test.js +++ b/frontend/src/lib/pt-br-locale.test.js @@ -27,7 +27,7 @@ describe('Brazilian Portuguese locale', () => { .sort(byCodeUnit) const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex') - expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(644) + expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(645) expect(inherited).toHaveLength(647) // If this fails, review the changed keys and wording before accepting a new hash. From // frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index fad9cba..c54dff9 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -580,6 +580,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} Übungen aus der Datei sind nicht in deiner Bibliothek und wurden weggelassen.', 'Use this weekly schedule': 'Diesen Wochenplan verwenden', 'Replaces your current Mon–Sun assignments.': 'Ersetzt deine aktuelle Mo–So-Belegung.', + 'Added {0} routine to your plan': '{0} Routine zu deinem Plan hinzugefügt', 'Added {0} routines to your plan': '{0} Routinen zu deinem Plan hinzugefügt', 'this isn’t an openGym plan file': 'das ist keine openGym-Plandatei', 'Shared routine': 'Geteilte Routine', diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js index 68e2144..b77e136 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} ejercicios del archivo no están en tu biblioteca y se han omitido.', 'Use this weekly schedule': 'Usar este horario semanal', 'Replaces your current Mon–Sun assignments.': 'Reemplaza tu asignación actual de lun–dom.', + 'Added {0} routine to your plan': 'Se añadió {0} rutina a tu plan', 'Added {0} routines to your plan': 'Se añadieron {0} rutinas a tu plan', 'this isn’t an openGym plan file': 'esto no es un archivo de plan de openGym', 'Shared routine': 'Rutina compartida', diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js index ff4b17c..5feda70 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} exercices du fichier ne sont pas dans ta bibliothèque et ont été ignorés.', 'Use this weekly schedule': 'Utiliser ce planning hebdomadaire', 'Replaces your current Mon–Sun assignments.': 'Remplace ton attribution lun–dim actuelle.', + 'Added {0} routine to your plan': '{0} routine ajoutée à ton plan', 'Added {0} routines to your plan': '{0} routines ajoutées à ton plan', 'this isn’t an openGym plan file': 'ce n\'est pas un fichier de plan openGym', 'Shared routine': 'Routine partagée', diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js index da466b3..485de72 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': 'फ़ाइल के {0} व्यायाम आपकी लाइब्रेरी में नहीं हैं और छोड़ दिए गए।', 'Use this weekly schedule': 'यह साप्ताहिक कार्यक्रम इस्तेमाल करें', 'Replaces your current Mon–Sun assignments.': 'आपके मौजूदा सोम–रवि निर्धारण को बदल देता है।', + 'Added {0} routine to your plan': 'आपके प्लान में {0} रूटीन जोड़ा गया', 'Added {0} routines to your plan': 'आपके प्लान में {0} रूटीन जोड़े गए', 'this isn’t an openGym plan file': 'यह openGym प्लान फ़ाइल नहीं है', 'Shared routine': 'साझा किया गया रूटीन', diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js index f99fa4f..0cfa720 100644 --- a/frontend/src/locales/hu.js +++ b/frontend/src/locales/hu.js @@ -540,6 +540,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} gyakorlat a fájlban nincs a könyvtáradban, ezért kimaradt.', 'Use this weekly schedule': 'Heti beosztás alkalmazása', 'Replaces your current Mon–Sun assignments.': 'Lecseréli a jelenlegi H–V beosztásod.', + 'Added {0} routine to your plan': '{0} rutin hozzáadva a tervedhez', 'Added {0} routines to your plan': '{0} rutin hozzáadva a tervedhez', 'this isn’t an openGym plan file': 'ez nem egy openGym tervfájl', 'Shared routine': 'Megosztott rutin', diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js index 3c8c841..8e80cd7 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} esercizi del file non sono nella tua libreria e sono stati esclusi.', 'Use this weekly schedule': 'Usa questo programma settimanale', 'Replaces your current Mon–Sun assignments.': 'Sostituisce la tua assegnazione lun–dom attuale.', + 'Added {0} routine to your plan': 'Aggiunta {0} routine al tuo piano', 'Added {0} routines to your plan': 'Aggiunte {0} routine al tuo piano', 'this isn’t an openGym plan file': 'questo non è un file di piano openGym', 'Shared routine': 'Routine condivisa', diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js index 48ea492..d5b13d3 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '파일의 운동 {0}개가 라이브러리에 없어 제외했습니다.', 'Use this weekly schedule': '이 주간 일정 사용', 'Replaces your current Mon–Sun assignments.': '현재 월–일 배정을 대체합니다.', + 'Added {0} routine to your plan': '계획에 루틴 {0}개를 추가했습니다', 'Added {0} routines to your plan': '계획에 루틴 {0}개를 추가했습니다', 'this isn’t an openGym plan file': 'openGym 계획 파일이 아닙니다', 'Shared routine': '공유된 루틴', diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js index 213baab..2d3321e 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} ćwiczeń z pliku nie ma w Twojej bibliotece i zostały pominięte.', 'Use this weekly schedule': 'Użyj tego harmonogramu tygodnia', 'Replaces your current Mon–Sun assignments.': 'Zastępuje Twój obecny przydział pon–niedz.', + 'Added {0} routine to your plan': 'Dodano {0} plan treningowy do Twojego planu', 'Added {0} routines to your plan': 'Dodano {0} planów treningowych do Twojego planu', 'this isn’t an openGym plan file': 'to nie jest plik planu openGym', 'Shared routine': 'Udostępniony plan treningowy', diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js index 324b0f2..087c696 100644 --- a/frontend/src/locales/pt-BR.js +++ b/frontend/src/locales/pt-BR.js @@ -210,6 +210,7 @@ export const PT_BR_OVERRIDES = { '{0} exercise in the file isn’t in your library and was left out.': '{0} exercício do arquivo não está na sua biblioteca e foi ignorado.', '{0} exercises in the file aren’t in your library and were left out.': '{0} exercícios do arquivo não estão na sua biblioteca e foram ignorados.', 'Replaces your current Mon–Sun assignments.': 'Substitui os dias definidos de segunda a domingo.', + 'Added {0} routine to your plan': '{0} rotina adicionada ao seu plano', 'Added {0} routines to your plan': '{0} rotinas adicionadas ao seu plano', 'this isn’t an openGym plan file': 'este não é um arquivo de plano do openGym', 'This screen could not be drawn. Your data is safe on this device.': 'Não foi possível exibir esta tela. Seus dados estão seguros neste dispositivo.', diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js index ea44d46..7619b0f 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} exercícios do ficheiro não estão na tua biblioteca e foram ignorados.', 'Use this weekly schedule': 'Usar este horário semanal', 'Replaces your current Mon–Sun assignments.': 'Substitui a tua atribuição atual de seg–dom.', + 'Added {0} routine to your plan': 'Adicionada {0} rotina ao teu plano', 'Added {0} routines to your plan': 'Adicionadas {0} rotinas ao teu plano', 'this isn’t an openGym plan file': 'isto não é um ficheiro de plano openGym', 'Shared routine': 'Rotina partilhada', diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js index 46ce8ef..85aaa63 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '{0} упражнений из файла отсутствуют в вашей библиотеке и были пропущены.', 'Use this weekly schedule': 'Использовать это расписание недели', 'Replaces your current Mon–Sun assignments.': 'Заменяет твоё текущее распределение пн–вс.', + 'Added {0} routine to your plan': 'В твой план добавлена {0} программа', 'Added {0} routines to your plan': 'В твой план добавлено программ: {0}', 'this isn’t an openGym plan file': 'это не файл плана openGym', 'Shared routine': 'Общая программа', diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js index f2b372d..bd0c87c 100644 --- a/frontend/src/locales/th.js +++ b/frontend/src/locales/th.js @@ -540,6 +540,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': 'มี {0} ท่าในไฟล์ที่ไม่มีในคลังของคุณ จึงถูกข้ามไป', 'Use this weekly schedule': 'ใช้ตารางรายสัปดาห์นี้', 'Replaces your current Mon–Sun assignments.': 'จะแทนที่ตารางจันทร์–อาทิตย์ปัจจุบันของคุณ', + 'Added {0} routine to your plan': 'เพิ่ม {0} รูทีนเข้าแผนของคุณแล้ว', 'Added {0} routines to your plan': 'เพิ่ม {0} รูทีนเข้าแผนของคุณแล้ว', 'this isn’t an openGym plan file': 'นี่ไม่ใช่ไฟล์แผนของ openGym', 'Shared routine': 'รูทีนที่แชร์มา', diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js index 95720d1..4bad8ce 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': 'Dosyadaki {0} egzersiz kitaplığında yok ve atlandı.', 'Use this weekly schedule': 'Bu hafta programını kullan', 'Replaces your current Mon–Sun assignments.': 'Mevcut Pzt–Paz atamanı değiştirir.', + 'Added {0} routine to your plan': 'Planına {0} rutin eklendi', 'Added {0} routines to your plan': 'Planına {0} rutin eklendi', 'this isn’t an openGym plan file': 'bu bir openGym plan dosyası değil', 'Shared routine': 'Paylaşılan rutin', diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js index f45110e..96f33b9 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -561,6 +561,7 @@ export default { '{0} exercises in the file aren’t in your library and were left out.': '文件中有 {0} 个动作不在你的动作库中,已略过。', 'Use this weekly schedule': '使用此每周日程', 'Replaces your current Mon–Sun assignments.': '替换你当前的周一至周日安排。', + 'Added {0} routine to your plan': '已向你的计划添加 {0} 个训练日', 'Added {0} routines to your plan': '已向你的计划添加 {0} 个训练日', 'this isn’t an openGym plan file': '这不是 openGym 计划文件', 'Shared routine': '共享的训练日', diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx index b93b303..451e910 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 } from './lib/exercises.js' import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js' -import { fmtDate, fmtNum, capWords, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js' +import { fmtDate, fmtNum, capWords, 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, workoutVolume, setsDone, setsDoneActive, setUnitsTotal, lastBW, supersetUnits, 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, barWeightFor, defaultBarWeight, hasBarOverride } from './lib/bar.js' import { toScale, rirOf, EFFORT_PRESETS, effortColor } from './lib/effort.js' @@ -1517,13 +1517,13 @@ function PlanImport({ bundle, close }) { const apply = () => { update(s => mergePlan(s, bundle, { schedule })) close() - toast(t('Added {0} routines to your plan', bundle.routineCount)) + toast(t(bundle.routineCount === 1 ? 'Added {0} routine to your plan' : 'Added {0} routines to your plan', bundle.routineCount)) nav('/plan') } return <>