Spanish exercise names for the whole catalogue
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
A Spanish profile now reads the catalogue in Spanish. Only pt-BR and hu had a
name pack, so every other language — Spanish included, which is this fork's
default — showed 1,324 English titles.
The pack is generated the way the pt-BR and hu ones were, with two differences
that matter to a self-hosted instance:
- `scripts/translate-es-exercise-names.mjs` talks to an OpenAI-compatible
endpoint instead of the `claude` CLI, because that is what the instance
already has: the same router the Coach runs on. Point it at one with
COACH_BASE_URL / COACH_MODEL / COACH_API_KEY.
- It is resumable. Ids already in the source file are skipped, so a run that
stops half way continues where it left off and a review only re-translates
what it deletes. With 1,324 rows, a pass that had to start over would never be
repeated.
Three rounds of review went into the file, each one caught by reading the output
rather than by the script succeeding:
1. "chin-up" and "pull-up" came back as English loanwords — the terms the
catalogue itself uses — so the core vocabulary is now pinned in the prompt and
asserted by the test (dominada, sentadilla, peso muerto, zancada, plancha…).
2. 142 rows led with the equipment ("Banda sentadilla", "Mancuerna press"), which
is the English word order. Spanish names the movement first: "Sentadilla con
banda". Those rows were re-translated, and the test now refuses a title that
starts with a piece of equipment — "Peso muerto" is why "Peso" is not on that
list.
3. Four rows dropped their (male) qualifier and four named variations kept an
English head noun ("Hack squat con barra"); both were fixed, the first by hand
since the review is allowed to edit the source.
The pack is honest about its provenance, like the pt-BR one: model-produced,
not reviewed by a native speaker, and the README says so.
This commit is contained in:
1 parent
40959de0a2
commit
996797bf00
7 files changed
+1673
-8
No files matched your search
@@ -0,0 +1,2 @@
|
||||
// generated by scripts/build-es-exercise-names.mjs — edit scripts/exercise-name-sources/es.json
|
||||
export default {"1000":"Elevación de gemelos una pierna inversa con banda","1001":"Sentadilla split una pierna con banda","1002":"Elevación de pierna recta tumbado con banda","1003":"Sentadilla con remo con banda","1004":"Sentadilla con banda","1005":"Crunch de pie con banda","1007":"Crunch de pie giratorio con banda","1008":"Step-up con banda","1009":"Peso muerto piernas rígidas con banda","1010":"Peso muerto piernas rectas con banda","1011":"Giro sentado con banda","1012":"Press militar giratorio sobre la cabeza con banda","1013":"Jalón al pecho agarre supino con banda","1014":"V-up con banda","1015":"Pallof press vertical con banda","1016":"Curl de muñeca con banda","1017":"Y-raise con banda","1018":"Encogimiento de hombros con banda","1022":"Remo del deltoide posterior de pie con banda","1023":"Peso muerto piernas rígidas espalda recta con banda","1160":"Burpee","1167":"Estiramiento dinámico de pecho (masculino)","1201":"Burpee con mancuerna","1253":"Elevación de gemelos en burro","1254":"press de banca con banda","1255":"pullover declinado con barra","1256":"Press de banca declinado agarre inverso con barra","1257":"Press de banca inclinado agarre inverso con barra","1258":"Press de banca con agarre inverso amplio con barra","1259":"Estiramiento de pecho detrás de la cabeza asistido","1260":"Press a una mano declinado con polea","1261":"Press declinado con polea","1262":"Apertura de pecho en banco declinado a una mano con polea","1263":"Apertura a una mano en fitball con polea","1264":"Apertura inclinada a una mano en fitball con polea","1265":"Press inclinado a una mano con polea","1266":"Press inclinado a una mano en fitball con polea","1267":"Press a una mano en fitball con polea","1268":"Press en fitball con polea","1269":"Cruzados de pie recto con cable","1270":"Cruzados para pecho superior con cable","1271":"Estiramiento de pecho y parte frontal del hombro","1272":"Estiramiento de pecho con fitball","1273":"Flexión con aplauso","1274":"Flexión profunda","1275":"Flexión caída","1276":"Apertura a una mano declinada con mancuerna","1277":"Aperturas con mancuerna en fitball","1278":"Aperturas inclinadas con mancuerna en fitball","1279":"Apertura a una mano inclinada con mancuerna","1280":"Apertura a una mano inclinada con mancuerna en fitball","1281":"Press a una mano inclinado con mancuerna","1282":"Press a una mano inclinado con mancuerna en fitball","1283":"Press inclinado con mancuerna en fitball","1284":"Pullover tumbado en fitball con mancuerna","1285":"Apertura a una mano en banco con mancuerna","1286":"Apertura a una mano en fitball con mancuerna","1287":"Press de pecho declinado a una mano con mancuerna","1288":"Apertura a una mano en fitball con mancuerna","1289":"Press de pecho inclinado a una mano con mancuerna","1290":"Press a una mano en fitball con mancuerna","1291":"Pullover a una mano en fitball con mancuerna","1292":"apertura a una pierna en fitball con mancuerna","1293":"press en fitball con mancuerna","1294":"pullover con extensión de cadera en fitball con mancuerna","1295":"pullover en fitball con mancuerna","1296":"Flexión pike en fitball","1297":"compresión isométrica de pecho","1298":"press de suelo a una mano con kettlebell","1299":"Press de pecho inclinado","1300":"Press de pecho declinado","1301":"Press interno de pecho en máquina","1302":"Pase de pecho con balón medicinal","1303":"Empuje de pecho desde posición de tres puntos con balón medicinal","1304":"Empuje de pecho con respuesta múltiple con balón medicinal","1305":"Empuje de pecho con respuesta única con balón medicinal","1306":"Flexión pliométrica","1307":"Flexión en bosu","1308":"Press de banca agarre amplio Smith","1309":"Press de banca declinado agarre amplio Smith","1310":"Flexión con caída con peso","1311":"Flexión con manos anchas","1312":"Empuje de pecho con liberación en carrera con balón medicinal","1313":"Palanca remo unilateral","1314":"extensión de espalda en fitball","1316":"Pullover brazo doblado con barra","1317":"Remo inclinado agarre inverso con barra","1318":"Remo en banco inclinado con polea","1319":"Remo rotación de palma con polea","1320":"Remo sentado cruce de cuerda con polea","1321":"Remo sentado elevado con cuerda y polea","1322":"Remo en banco inclinado con cuerda","1323":"Remo sentado con cuerda","1324":"Remo alto con polea","1325":"Jalón al pecho agarre amplio detrás del cuello con polea","1326":"Dominada supina","1327":"Dominada supina agarre cerrado","1328":"Remo posterior del deltoide tumbado con mancuerna","1329":"remo inclinado con rotación de palma con mancuerna","1330":"Remo a una mano en banco inclinado con agarre supino con mancuerna","1331":"Remo a dos manos en banco inclinado con agarre supino con mancuerna","1332":"Elevaciones alternas de brazos en fitball","1333":"Extensión de espalda con brazos extendidos en fitball","1334":"Extensión de espalda con manos detrás de la cabeza en fitball","1335":"Extensión de espalda con rodillas fuerLine truncated
|
||||
@@ -0,0 +1,119 @@
|
||||
// The Spanish exercise-name pack: 1,324 titles so a Spanish profile reads the catalogue in its
|
||||
// own language instead of English. Modelled on pt-br-exercise-names.test.js, with the terms this
|
||||
// pack was actually translated with — the ones a Spanish gym would notice immediately if a row
|
||||
// slipped back into English.
|
||||
import { afterEach, describe, expect, test } from 'vitest'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import es from '../exercise-names/es.js'
|
||||
import { EXDB } from './exercises-data.js'
|
||||
import {
|
||||
EXERCISE_NAME_LANGS, _setLangState, exerciseNameFor, exerciseNameSearchText
|
||||
} from './i18n-core.js'
|
||||
|
||||
describe('Spanish exercise names', () => {
|
||||
const source = JSON.parse(readFileSync(new URL('../../../scripts/exercise-name-sources/es.json', import.meta.url), 'utf8'))
|
||||
afterEach(() => _setLangState('en', {}, null, null))
|
||||
|
||||
test('matches the curated source and covers the complete built-in catalogue', () => {
|
||||
expect(Object.keys(es)).toHaveLength(EXDB.length)
|
||||
expect(es).toEqual(source)
|
||||
expect(EXERCISE_NAME_LANGS).toContain('es')
|
||||
})
|
||||
|
||||
test('contains a non-empty translation for every known exercise', () => {
|
||||
for (const exercise of EXDB) {
|
||||
expect(es[exercise.id]?.trim(), exercise.id).toBeTruthy()
|
||||
// A Spanish pack that reads like Portuguese is the failure this catches: the two languages
|
||||
// share most of their gym vocabulary, so a model drifting into pt-BR is easy to miss.
|
||||
expect(es[exercise.id], exercise.id).not.toMatch(/(?:^|[^\p{L}])(?:halter(?:es)?|panturrilha|agachamento|rosca|remada|cintura|joelho|deitado|em p[eé]|sentadilha|levantamento terra|peito)(?=$|[^\p{L}])/iu)
|
||||
}
|
||||
})
|
||||
|
||||
// The core lifts have one right answer in Spanish. Left to itself a model writes "chin-up" and
|
||||
// "pull-up" — the same loanword the English catalogue uses — which is exactly what the first
|
||||
// pass of this pack did before the terminology was pinned down.
|
||||
//
|
||||
// KEPT is the other half of that instruction: a handful of terms are what Spanish gyms actually
|
||||
// say, so the translator was told to leave them alone. "Hack squat con barra" is a correct
|
||||
// translation, and a rule that insisted on /sentadilla/ there would fail it.
|
||||
const KEPT = /hack squat|leg press|hip thrust|face pull|burpee|kettlebell|smith machine/iu
|
||||
const CORE = [
|
||||
[/\bpull-up\b/iu, /dominada/iu],
|
||||
[/\bchin-up\b/iu, /dominada/iu],
|
||||
[/\bpush-up\b/iu, /flexi[oó]n/iu],
|
||||
[/\bdip\b/iu, /fondo/iu],
|
||||
[/\bsquat\b/iu, /sentadilla/iu],
|
||||
[/\blunge\b/iu, /zancada/iu],
|
||||
[/\bdeadlift\b/iu, /peso muerto/iu],
|
||||
[/\bplank\b/iu, /plancha/iu],
|
||||
[/\brow\b/iu, /remo/iu],
|
||||
[/\bsit-up\b/iu, /abdominal/iu],
|
||||
]
|
||||
test('uses the established Spanish term for the core lifts, not the English loanword', () => {
|
||||
// A parenthetical is a note about the variant, not the exercise: "chest dip (on dip-pull-up
|
||||
// cage)" is a dip — the cage is where you do it — so the rules read the name without them.
|
||||
//
|
||||
// And a "pull-up pulldown" is a pulldown loaded the way a pull-up is: the pull-up names the
|
||||
// style, the exercise is the jalón. One row in the catalogue, stated here rather than left to
|
||||
// a looser rule that would stop catching the real thing.
|
||||
const bare = name => name.replace(/\([^)]*\)/g, ' ')
|
||||
for (const exercise of EXDB) {
|
||||
const name = bare(exercise.n)
|
||||
if (KEPT.test(name)) continue
|
||||
const core = /pulldown/iu.test(name) ? CORE.filter(([english]) => !/pull-up|chin-up/iu.test(english.source)) : CORE
|
||||
for (const [english, spanish] of core) {
|
||||
if (english.test(name)) expect(es[exercise.id], `${exercise.id}: ${exercise.n}`).toMatch(spanish)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('preserves identity-changing qualifiers and equipment', () => {
|
||||
const rules = [
|
||||
[/assisted/iu, /asistid/iu],
|
||||
[/weighted/iu, /(?:con peso|lastrad|ponderad)/iu],
|
||||
[/(?:^|[^\p{L}])male(?=$|[^\p{L}])/iu, /masculin/iu],
|
||||
[/(?:^|[^\p{L}])female(?=$|[^\p{L}])/iu, /femenin/iu],
|
||||
[/barbell/iu, /barra/iu],
|
||||
[/dumbbell/iu, /mancuerna/iu],
|
||||
[/kettlebell/iu, /kettlebell/iu],
|
||||
[/smith/iu, /smith/iu],
|
||||
[/stability ball/iu, /fitball|pelota de estabilidad/iu],
|
||||
[/medicine ball/iu, /bal[oó]n medicinal/iu],
|
||||
[/one arm|single arm/iu, /(?:a|de) una mano|unilateral/iu],
|
||||
[/close grip/iu, /agarre cerrado/iu],
|
||||
]
|
||||
for (const exercise of EXDB) {
|
||||
for (const [english, spanish] of rules) {
|
||||
if (english.test(exercise.n)) expect(es[exercise.id], `${exercise.id}: ${english}`).toMatch(spanish)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Spanish names the movement first and the equipment after it: "Sentadilla con banda", never
|
||||
// "Banda sentadilla". The first pass did exactly that in 142 rows — a model translating "band
|
||||
// squat" reaches for the English word order — and nothing about those rows looks broken until
|
||||
// you read one aloud. "Peso muerto" is why `Peso` is not in this list: it is the exercise's own
|
||||
// name, not a piece of equipment.
|
||||
test('never leads with the equipment', () => {
|
||||
for (const exercise of EXDB) {
|
||||
expect(es[exercise.id], `${exercise.id}: ${exercise.n}`)
|
||||
.not.toMatch(/^(?:Barra|Banda|Mancuerna|Mancuernas|Máquina|Polea|Kettlebell|Balón|Fitball|Pelota|Cuerda|Cable|Disco) /iu)
|
||||
}
|
||||
})
|
||||
|
||||
test('shows Spanish first and preserves the canonical English title', () => {
|
||||
const exercise = EXDB[0]
|
||||
_setLangState('es', {}, null, es)
|
||||
expect(exerciseNameFor(exercise)).toBe(`${es[exercise.id]} (${exercise.n})`)
|
||||
expect(exerciseNameSearchText(exercise)).toContain(es[exercise.id])
|
||||
expect(exerciseNameSearchText(exercise)).toContain(exercise.n)
|
||||
})
|
||||
|
||||
test('never translates custom exercises or changes other languages', () => {
|
||||
const custom = { id: 'custom-1', n: 'Mi ejercicio' }
|
||||
_setLangState('es', {}, null, es)
|
||||
expect(exerciseNameFor(custom)).toBe('Mi ejercicio')
|
||||
_setLangState('en', {}, null, null)
|
||||
expect(exerciseNameFor(EXDB[0])).toBe(EXDB[0].n)
|
||||
})
|
||||
})
|
||||
@@ -10,7 +10,10 @@ export const LANGS = {
|
||||
ko: '한국어', hi: 'हिन्दी', th: 'ไทย', hu: 'Magyar'
|
||||
}
|
||||
export const INSTR_LANGS = ['en', 'es', 'fr', 'it', 'tr', 'ru', 'zh', 'hi', 'pl', 'ko', 'pt-BR', 'hu']
|
||||
export const EXERCISE_NAME_LANGS = ['pt-BR', 'hu']
|
||||
// Languages with a complete translated title for every built-in exercise. English is absent
|
||||
// because it *is* the catalogue; anything listed here needs frontend/src/exercise-names/<lang>.js
|
||||
// covering all 1,324 rows, or the pack loader falls back to English mid-list.
|
||||
export const EXERCISE_NAME_LANGS = ['es', 'pt-BR', 'hu']
|
||||
export const DATE_LOCALES = {
|
||||
en: 'en-GB', de: 'de-DE', 'de-CH': 'de-CH', es: 'es-ES', fr: 'fr-FR', it: 'it-IT',
|
||||
pt: 'pt-PT', 'pt-BR': 'pt-BR',
|
||||
|
||||
Reference in new issue
Block a user