feat(i18n): localize pt-BR exercise names
This commit is contained in:
1 parent
dc3fafc6ef
commit
448c66752f
21 files changed
+1615
-53
No files matched your search
@@ -3,7 +3,7 @@ import { useStore } from '../store/useStore.js'
|
||||
import { EXDB, BODYPARTS, allExercises, equipmentOf } from '../lib/exercises.js'
|
||||
import { bestWeightFor } from '../lib/history.js'
|
||||
import { fmtNum } from '../lib/format.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { t, exerciseNameFor, exerciseNameSearchText } from '../lib/i18n.js'
|
||||
import { Thumb } from '../components/Media.jsx'
|
||||
import { exerciseDetailSheet, addToRoutineSheet, customExSheet } from '../sheets.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
@@ -16,7 +16,7 @@ export default function Library() {
|
||||
const [eq, setEq] = useState('')
|
||||
const [shown, setShown] = useState(40)
|
||||
const ql = q.toLowerCase().trim()
|
||||
const base = allExercises(S).filter(e => (!bp || e.bp === bp) && (!ql || e.n.toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql) || (e.desc || '').toLowerCase().includes(ql)))
|
||||
const base = allExercises(S).filter(e => (!bp || e.bp === bp) && (!ql || exerciseNameSearchText(e).toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql) || (e.desc || '').toLowerCase().includes(ql)))
|
||||
const eqOpts = equipmentOf(base)
|
||||
// Drop the equipment filter if the search narrowed it away, so you never hit a dead end.
|
||||
const eqOn = eqOpts.includes(eq) ? eq : ''
|
||||
@@ -43,7 +43,7 @@ export default function Library() {
|
||||
const best = bestWeightFor(S, e.id)
|
||||
return <div key={e.id} className="item" onClick={() => exerciseDetailSheet(e)}>
|
||||
<Thumb ex={e} />
|
||||
<div className="grow"><div className="tt capitalize">{e.n}</div><div className="ss capitalize">{t(e.tg || e.bp)} · {t(e.eq)}</div></div>
|
||||
<div className="grow"><div className="tt capitalize">{exerciseNameFor(e)}</div><div className="ss capitalize">{t(e.tg || e.bp)} · {t(e.eq)}</div></div>
|
||||
{best > 0 && <span className="tag acc">{fmtNum(best)}</span>}
|
||||
<Button size="sm" variant="tinted" icon="plus" onClick={ev => { ev.stopPropagation(); addToRoutineSheet(e) }}>{t('Plan')}</Button>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useEffect } from 'react'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { exOr } from '../lib/exercises.js'
|
||||
import { uid } from '../lib/format.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { t, exerciseNameFor } from '../lib/i18n.js'
|
||||
import { supersetUnits, cleanupSg, exLine } from '../lib/history.js'
|
||||
import { Thumb } from '../components/Media.jsx'
|
||||
import { glyphPicker, exercisePicker, exConfigSheet, confirmSheet } from '../sheets.jsx'
|
||||
@@ -67,7 +67,7 @@ export default function RoutineEdit() {
|
||||
exConfigSheet(ex, e, cfg => edit(x => { x[i] = { id: x[i].id, sg: x[i].sg, ...cfg } }), () => edit(x => { x.splice(i, 1); cleanupSg(x) }), r)
|
||||
}}>
|
||||
<Thumb ex={ex} />
|
||||
<div className="grow"><div className="tt capitalize">{ex.n}</div><div className="ss">{exLine(e, S.unit)}</div></div>
|
||||
<div className="grow"><div className="tt capitalize">{exerciseNameFor(ex)}</div><div className="ss">{exLine(e, S.unit)}</div></div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, flex: 'none', alignItems: 'center' }}>
|
||||
{i > 0 && <button className={'iconbtn' + (linkedPrev ? ' on-ss' : '')} title={t('Superset with exercise above')} style={{ width: 32, height: 28, borderRadius: 8, fontSize: 15 }} onClick={ev => { ev.stopPropagation(); toggleLink(i) }}><Icon name="link" /></button>}
|
||||
<div style={{ display: 'flex', gap: 2 }}>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useStore } from '../store/useStore.js'
|
||||
import { EXIDX } from '../lib/exercises.js'
|
||||
import { lastBW, streakWeeks, setLabel, modeOf, effortOf, metricModeForEntry, metricRowsForEntry, bestWeightForEntry } from '../lib/history.js'
|
||||
import { fmtNum, fmtDate, fmtVol, todayISO, weekKey } from '../lib/format.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { t, exerciseNameFor, getLang } from '../lib/i18n.js'
|
||||
import { bwSheet, goalSheet, calendarSheet, workoutDetailSheet, WorkoutRow, bwDeltaColor } from '../sheets.jsx'
|
||||
import LineChart from '../components/LineChart.jsx'
|
||||
import Heatmap from '../components/Heatmap.jsx'
|
||||
@@ -102,6 +102,7 @@ function MuscleBalance({ S }) {
|
||||
const [hard, setHard] = useState(false)
|
||||
const [sel, setSel] = useState(null)
|
||||
const now = useNow()
|
||||
const lang = getLang()
|
||||
const workouts = S.workouts
|
||||
// The user's own last registered bodyweight drives bodyweight-exercise tonnage.
|
||||
const bodyweightKg = useMemo(() => {
|
||||
@@ -113,7 +114,7 @@ function MuscleBalance({ S }) {
|
||||
}, [S.bodyweight, S.unit])
|
||||
const fatigue = useMemo(() => fatigueOf(workouts, now, { bodyweightKg, unit: S.unit }), [workouts, now, bodyweightKg, S.unit])
|
||||
const strength = useMemo(() => strengthOf(workouts, now, { bodyweightKg, unit: S.unit }), [workouts, now, bodyweightKg, S.unit])
|
||||
const muscleExercises = useMemo(() => (sel ? strengthExerciseRowsForMuscle(S, now, sel) : []), [S, now, sel])
|
||||
const muscleExercises = useMemo(() => (sel ? strengthExerciseRowsForMuscle(S, now, sel) : []), [S, now, sel, lang])
|
||||
const lastTrained = useMemo(() => latestMuscleTraining(workouts), [workouts])
|
||||
const strengthHint = slug => {
|
||||
if (lastTrained[slug] == null) return t('not trained')
|
||||
@@ -290,7 +291,7 @@ export default function Stats() {
|
||||
const workouts = S.workouts
|
||||
const monthW = workouts.filter(w => String(w.d || '').slice(0, 7) === todayISO().slice(0, 7)).length
|
||||
|
||||
const nameOf = id => EXIDX[id]?.n || workouts.flatMap(w => w.entries).find(e => e.id === id)?.n || id
|
||||
const nameOf = id => EXIDX[id] ? exerciseNameFor(EXIDX[id]) : (workouts.flatMap(w => w.entries).find(e => e.id === id)?.n || id)
|
||||
const currentOf = id => {
|
||||
for (let i = workouts.length - 1; i >= 0; i--) {
|
||||
const en = workouts[i].entries.find(e => e.id === id)
|
||||
|
||||
@@ -6,7 +6,7 @@ import { exOr } from '../lib/exercises.js'
|
||||
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, freestyleConfig, defaultConfig, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg } from '../lib/history.js'
|
||||
import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
|
||||
import { beep, vibrate } from '../lib/sound.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { t, exerciseNameFor } from '../lib/i18n.js'
|
||||
import { api } from '../lib/api.js'
|
||||
import { setProgressHighWater, supersetFlowStep } from '../lib/supersetFlow.js'
|
||||
import Media from '../components/Media.jsx'
|
||||
@@ -113,7 +113,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
return <>
|
||||
<Media ex={ex} key={entry.id} compact={compact} minimizable />
|
||||
<div className="row between" style={{ marginBottom: 6 }}>
|
||||
<div style={{ fontSize: compact ? 17 : 20, fontWeight: 600, letterSpacing: '-.02em', textTransform: 'capitalize', lineHeight: 1.2 }}>{ex.n}</div>
|
||||
<div style={{ fontSize: compact ? 17 : 20, fontWeight: 600, letterSpacing: '-.02em', textTransform: 'capitalize', lineHeight: 1.2 }}>{exerciseNameFor(ex)}</div>
|
||||
<button className="iconbtn" aria-label={t('Details')} onClick={() => exerciseDetailSheet(ex)}><Icon name="info" /></button>
|
||||
</div>
|
||||
{!compact && (onPairPrev || onPairNext) && <div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>
|
||||
@@ -258,7 +258,7 @@ function ActiveWorkout() {
|
||||
if (!e) return
|
||||
const hasDone = (e.sets || []).some(s => s.done)
|
||||
confirmSheet({
|
||||
title: t('Remove {0}?', exOr(e.id).n),
|
||||
title: t('Remove {0}?', exerciseNameFor(exOr(e.id))),
|
||||
message: hasDone
|
||||
? t('The sets you logged for this exercise in this session will be lost.')
|
||||
: t('This removes the exercise from your current session.'),
|
||||
@@ -273,7 +273,7 @@ function ActiveWorkout() {
|
||||
<div className="muted small" style={{ marginBottom: 12 }}>{t('Which exercise in this superset do you want to remove?')}</div>
|
||||
<div className="list">
|
||||
{unit.map(idx => <div key={idx} className="item" onClick={() => { close(); confirmRemoveExercise(idx) }}>
|
||||
<div className="grow"><div className="tt">{exOr(A.entries[idx]?.id).n}</div></div>
|
||||
<div className="grow"><div className="tt">{exerciseNameFor(exOr(A.entries[idx]?.id))}</div></div>
|
||||
<Icon name="chevronRight" />
|
||||
</div>)}
|
||||
</div>
|
||||
@@ -288,7 +288,7 @@ function ActiveWorkout() {
|
||||
// behave exactly as they do for a reps set.
|
||||
const startTimed = (idx, i) => {
|
||||
const e = A.entries[idx]
|
||||
useUI.getState().startWork(e.sets[i].sec || 45, exOr(e.id).n, elapsed => {
|
||||
useUI.getState().startWork(e.sets[i].sec || 45, exerciseNameFor(exOr(e.id)), elapsed => {
|
||||
mutEntry(idx, en => { en.sets[i].sec = elapsed })
|
||||
if (!useStore.getState().S.active.entries[idx].sets[i].done) toggle(idx, i)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user