Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Arabic, Ukrainian and the other packs: a workout's length in History, the finish summary, the heatmap and the duration field reads in the language's own units instead of a Latin min, h and m
Duarte Santosbcc5c143c282
diff --git a/frontend/src/components/Heatmap.jsx b/frontend/src/components/Heatmap.jsxindex 16d1f95f7..12e10aea1 100644--- a/frontend/src/components/Heatmap.jsx+++ b/frontend/src/components/Heatmap.jsx@@ -69,7 +69,7 @@ export default function Heatmap({ S, onDay, metric: selectedMetric, onMetricChanconst a = agg[key]const cls = 'hm-c l' + level(a) + (key === todayISO() ? ' today' : '') + (day > today ? ' future' : '')cells.push(<div key={d} className={cls}- title={key + (a ? ` · ${t(a.n === 1 ? '{0} workout' : '{0} workouts', a.n)} · ${a.min} min · ${fmtVol(a.vol, S.unit)}` : '')}+ title={key + (a ? ` · ${t(a.n === 1 ? '{0} workout' : '{0} workouts', a.n)} · ${t('{0} min', a.min)} · ${fmtVol(a.vol, S.unit)}` : '')}{...tappable(a ? () => onDay?.(key) : undefined)} />)}cols.push(<div key={wk} className="hm-col">{cells}</div>)diff --git a/frontend/src/lib/format-ago.test.js b/frontend/src/lib/format-ago.test.jsindex 23663f6e1..c9d93f031 100644--- a/frontend/src/lib/format-ago.test.js+++ b/frontend/src/lib/format-ago.test.js@@ -1,5 +1,8 @@-import { describe, expect, it } from 'vitest'-import { fmtAgo, changeCount } from './format.js'+import { afterEach, describe, expect, it } from 'vitest'+import { fmtAgo, changeCount, fmtDur } from './format.js'+import { _setLangState } from './i18n-core.js'+import ar from '../locales/ar.js'+import uk from '../locales/uk.js'// "Last synced: …" in Settings — the platform words it, in the UI language (en-GB here).describe('fmtAgo', () => {@@ -23,3 +26,23 @@ describe('changeCount', () => {expect(changeCount(3)).toBe('3 changes')})})++// A session's length in the UI language. The units were Latin letters in every pack, so an+// Arabic or Ukrainian History row read "34 min" and "1h 5m" in the middle of its own script.+describe('fmtDur', () => {+ afterEach(() => _setLangState('en', {}, null, null))++ it('reads minutes, and hours with minutes past the hour, in English as before', () => {+ expect(fmtDur(34 * 60000)).toBe('34 min')+ expect(fmtDur(175 * 60000)).toBe('2h 55m')+ })++ it('uses each pack\'s own units', () => {+ _setLangState('ar', ar, null, null)+ expect(fmtDur(34 * 60000)).toBe('34 دقيقة')+ expect(fmtDur(65 * 60000)).toBe('1 ساعة 5 دقيقة')+ _setLangState('uk', uk, null, null)+ expect(fmtDur(34 * 60000)).toBe('34 хв')+ expect(fmtDur(65 * 60000)).toBe('1 год 5 хв')+ })+})diff --git a/frontend/src/lib/format.js b/frontend/src/lib/format.jsindex ab9d60421..af34cb3b4 100644--- a/frontend/src/lib/format.js+++ b/frontend/src/lib/format.js@@ -18,9 +18,10 @@ export function fmtDate(iso, long, withYear = false) {if (withYear) options.year = 'numeric'return d.toLocaleDateString(dateLocale(), options)}+// In the UI language: the Latin h, m and min stood inside Arabic and Ukrainian rows.export function fmtDur(ms) {const m = Math.floor(ms / 60000)- return m >= 60 ? Math.floor(m / 60) + 'h ' + (m % 60) + 'm' : m + ' min'+ return m >= 60 ? t('{0}h {1}m', Math.floor(m / 60), m % 60) : t('{0} min', m)}// Imported history has no clock — an unknown duration is left out rather than shown as "0 min".export const durPart = ms => (ms >= 60000 ? [fmtDur(ms)] : [])diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex d074b905f..3a4c5e5d1 100644--- a/frontend/src/lib/pt-br-locale.test.js+++ b/frontend/src/lib/pt-br-locale.test.js@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {// has to be taught is a number nobody reads. What the numbers stood for is asserted above.// If the hash fails, review the changed keys and wording before accepting a new one. From// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('8a78402841d4c137840dadd3a1dd5a2bc6af4de533d4586cb84566f83b14243a')+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('0371d550d1b87e35334f3e18933f91b64621268c5c3075f41ec3cd732aaa0dd1')})test('does not leak European Portuguese UI terms', () => {diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex 69e636c6b..a693ea8fb 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -813,6 +813,7 @@ export default {'Turn the Coach off': 'إيقاف المدرب','{0} days a week': '{0} أيام في الأسبوع','{0} min': '{0} دقيقة',+ '{0}h {1}m': '{0} ساعة {1} دقيقة','The Coach is on': 'المدرب يعمل','Before the Coach starts': 'قبل أن يبدأ المدرب','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'عندما تطلب خطة أو مراجعة، يرسل هذا المثيل ما يلي إلى {0}، الذي يعمل على هذا الخادم تحت حساب مالك المثيل.',diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 59e0932e1..db7e419cd 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -850,6 +850,7 @@ export default {'Turn the Coach off': 'Coach ausschalten','{0} days a week': '{0} Tage pro Woche','{0} min': '{0} Min.',+ '{0}h {1}m': '{0} Std. {1} Min.','The Coach is on': 'Coach ist an','Before the Coach starts': 'Bevor der Coach loslegt','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Wenn du einen Plan oder eine Auswertung anforderst, sendet diese Instanz Folgendes an {0}, das auf diesem Server unter dem Konto des Betreibers läuft.',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 90db2876f..ee434cc4a 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'Desactivar el Entrenador','{0} days a week': '{0} días a la semana','{0} min': '{0} min',+ '{0}h {1}m': '{0} h {1} min','The Coach is on': 'Entrenador activado','Before the Coach starts': 'Antes de empezar','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Cuando pides un plan o una revisión, esta instancia envía lo siguiente a {0}, que se ejecuta en este servidor con la cuenta del propietario.',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 38014dc8e..10d5e57bf 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'Désactiver le Coach','{0} days a week': '{0} jours par semaine','{0} min': '{0} min',+ '{0}h {1}m': '{0} h {1} min','The Coach is on': 'Coach activé','Before the Coach starts': 'Avant de commencer','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Quand vous demandez un plan ou un bilan, cette instance envoie ce qui suit à {0}, qui tourne sur ce serveur avec le compte du propriétaire.',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 8d4284310..f09d89b7f 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'कोच बंद करें','{0} days a week': 'हफ़्ते में {0} दिन','{0} min': '{0} मिनट',+ '{0}h {1}m': '{0} घंटे {1} मिनट','The Coach is on': 'कोच चालू है','Before the Coach starts': 'कोच के शुरू होने से पहले','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'जब आप प्लान या समीक्षा माँगते हैं, तो यह इंस्टेंस निम्नलिखित {0} को भेजता है, जो इसी सर्वर पर मालिक के खाते से चलता है।',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 27b983b0f..9a7ea174a 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -998,6 +998,7 @@ export default {'Turn the Coach off': 'Az Edző kikapcsolása','{0} days a week': 'Heti {0} nap','{0} min': '{0} perc',+ '{0}h {1}m': '{0} ó {1} perc','The Coach is on': 'Az Edző be van kapcsolva','Before the Coach starts': 'Mielőtt az Edző elindul','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Amikor tervet vagy áttekintést kérsz, ez a példány a következőket küldi el ide: {0}, ezen a szerveren, a példány tulajdonosának fiókjával.',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 88c4151c2..08b16d8d8 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'Disattiva il Coach','{0} days a week': '{0} giorni a settimana','{0} min': '{0} min',+ '{0}h {1}m': '{0} h {1} min','The Coach is on': 'Coach attivo','Before the Coach starts': 'Prima di iniziare','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Quando chiedi un piano o una revisione, questa istanza invia quanto segue a {0}, che gira su questo server con l’account del proprietario.',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 18ffb592a..0b61e317c 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': '코치 끄기','{0} days a week': '주 {0}일','{0} min': '{0}분',+ '{0}h {1}m': '{0}시간 {1}분','The Coach is on': '코치 켜짐','Before the Coach starts': '코치를 시작하기 전에','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': '계획이나 리뷰를 요청하면, 이 인스턴스는 다음 정보를 이 서버에서 운영자 계정으로 실행 중인 {0}에 전송합니다.',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex a301b981b..be092f505 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'Wyłącz Trenera','{0} days a week': '{0} dni w tygodniu','{0} min': '{0} min',+ '{0}h {1}m': '{0} godz. {1} min','The Coach is on': 'Trener włączony','Before the Coach starts': 'Zanim Trener zacznie','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Gdy poprosisz o plan lub przegląd, ta instancja wysyła następujące dane do {0}, działającego na tym serwerze na koncie właściciela.',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 4dec9f3ff..06bc04e4f 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'Desligar o Treinador','{0} days a week': '{0} dias por semana','{0} min': '{0} min',+ '{0}h {1}m': '{0} h {1} min','The Coach is on': 'Treinador ligado','Before the Coach starts': 'Antes de começar','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Quando pedes um plano ou uma revisão, esta instância envia o seguinte para {0}, que corre neste servidor na conta do proprietário.',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 6066b65c8..dd3a3798f 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'Выключить Тренера','{0} days a week': '{0} дней в неделю','{0} min': '{0} мин',+ '{0}h {1}m': '{0} ч {1} мин','The Coach is on': 'Тренер включён','Before the Coach starts': 'Прежде чем Тренер начнёт','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Когда вы запрашиваете план или разбор, этот сервер отправляет следующее в {0}, работающий здесь под учётной записью владельца.',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 05eda4bd7..3760b7bb4 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -1006,6 +1006,7 @@ export default {'Turn the Coach off': 'ปิดโค้ช','{0} days a week': '{0} วันต่อสัปดาห์','{0} min': '{0} นาที',+ '{0}h {1}m': '{0} ชม. {1} นาที','The Coach is on': 'โค้ชเปิดอยู่','Before the Coach starts': 'ก่อนที่โค้ชจะเริ่ม','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'เมื่อคุณขอแผนหรือรีวิว อินสแตนซ์นี้จะส่งข้อมูลต่อไปนี้ไปยัง {0} ซึ่งทำงานบนเซิร์ฟเวอร์นี้ภายใต้บัญชีของเจ้าของอินสแตนซ์',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex c583b4123..1141f249f 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': 'Koç’u kapat','{0} days a week': 'haftada {0} gün','{0} min': '{0} dk',+ '{0}h {1}m': '{0} sa {1} dk','The Coach is on': 'Koç açık','Before the Coach starts': 'Koç başlamadan önce','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Bir plan veya değerlendirme istediğinde, bu sunucu şunları bu makinede sunucu sahibinin hesabıyla çalışan {0} hizmetine gönderir.',diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex d94e722b1..7302f0a16 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -662,6 +662,7 @@ export default {'Turn the Coach off': 'Вимкнути Тренера','{0} days a week': '{0} днів на тиждень','{0} min': '{0} хв',+ '{0}h {1}m': '{0} год {1} хв','The Coach is on': 'Тренер увімкнений','Before the Coach starts': 'Перш ніж Тренер почне','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': 'Коли ти запитуєш план чи розбір, цей сервер надсилає наведене нижче в {0}, що працює тут під обліковим записом власника сервера.',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex d31e8db85..4d8dac2dd 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -832,6 +832,7 @@ export default {'Turn the Coach off': '关闭教练','{0} days a week': '每周 {0} 天','{0} min': '{0} 分钟',+ '{0}h {1}m': '{0} 小时 {1} 分钟','The Coach is on': '教练已开启','Before the Coach starts': '在教练开始之前','When you ask for a plan or a review, this instance sends the following to {0}, running on this server under the instance owner’s account.': '当你请求计划或复盘时,本实例会将以下内容发送给 {0}——它在本服务器上以实例所有者的账号运行。',diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 59ac266bb..017da77ae 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -1882,7 +1882,7 @@ function WorkoutDurationEdit({ w, onDone, close }) {return <><h3>{t('Change duration')}</h3><div className="muted small" style={{ marginBottom: 12 }}>{t('Forgot to finish on time? Set how long the session really took. It keeps its start time and its sets.')}</div>- <Stepper label={t('Duration')} unit="min" value={dur} step={5} min={1} decimal={false} onChange={v => setDur(Math.round(v))} />+ <Stepper label={t('Duration')} unit={t('min')} value={dur} step={5} min={1} decimal={false} onChange={v => setDur(Math.round(v))} /><div style={{ height: 18 }} /><Button variant="primary" onClick={save}>{t('Save')}</Button></>@@ -2159,7 +2159,7 @@ function LogPastWorkout({ initial, close }) {<input type="date" className="timef" value={date} max={today} onChange={e => setDate(e.target.value)} /></Row><Row icon="clock" title={t('Start time')}><input type="time" className="timef" value={time} onChange={e => setTime(e.target.value)} /></Row>- <Stepper label={t('Duration')} unit="min" value={dur} step={5} min={1} decimal={false} onChange={v => setDur(Math.round(v))} />+ <Stepper label={t('Duration')} unit={t('min')} value={dur} step={5} min={1} decimal={false} onChange={v => setDur(Math.round(v))} /><div style={{ height: 8 }} /><SelectRow icon="dumbbell" title={t('Routine')} value={routineId} options={options} onChange={setRoutineId} /><div style={{ height: 18 }} />