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
i18n: three-form plurals, and the Russian forms (v1.3.9 known issue)
Dima Po6dd9c35e3ed7
diff --git a/frontend/scripts/check-locales.mjs b/frontend/scripts/check-locales.mjsindex e03d130e7..c90792d4b 100644--- a/frontend/scripts/check-locales.mjs+++ b/frontend/scripts/check-locales.mjs@@ -51,8 +51,20 @@ for (const [lang, dict] of locales) {const orphans = union.filter(k => keys.has(k) && seen.get(k) === 1)// A blank value is worse than no translation: the English fallback only runs for a key that// is ABSENT, so an empty string reaches the screen as an empty screen.- const blank = Object.entries(dict).filter(([, v]) => typeof v !== 'string' || !v.trim()).map(([k]) => k)- const mangled = Object.entries(dict).filter(([k, v]) => typeof v === 'string' && marks(v) !== marks(k))+ // A plural entry (tn()) answers with the forms of a language that needs more than two —+ // { one, few, many } for Russian — instead of one string. Every form is held to the same+ // rules a plain string is: present, not blank, same placeholders as the English key.+ const formsOf = v => (v && typeof v === 'object' && !Array.isArray(v) ? Object.values(v) : null)+ const blank = Object.entries(dict).filter(([, v]) => {+ const forms = formsOf(v)+ if (forms) return !forms.length || forms.some(f => typeof f !== 'string' || !f.trim())+ return typeof v !== 'string' || !v.trim()+ }).map(([k]) => k)+ const mangled = Object.entries(dict).flatMap(([k, v]) => {+ const forms = formsOf(v)+ if (forms) return forms.filter(f => typeof f === 'string' && marks(f) !== marks(k)).map(f => [k, f])+ return typeof v === 'string' && marks(v) !== marks(k) ? [[k, v]] : []+ })if (missing.length || orphans.length || blank.length || mangled.length) {failed = trueconsole.error(`\n${lang}.js: ${keys.size}/${union.length} keys`)diff --git a/frontend/src/components/Heatmap.jsx b/frontend/src/components/Heatmap.jsxindex 12e10aea1..077bce5ca 100644--- a/frontend/src/components/Heatmap.jsx+++ b/frontend/src/components/Heatmap.jsx@@ -1,7 +1,7 @@import { useEffect, useRef, useState } from 'react'import { fmtVol, isoOf, todayISO, MONTHS, weekStartOf, weekDayOffset } from '../lib/format.js'import { workoutDay, workoutDuration, workoutVolume } from '../lib/history.js'-import { t } from '../lib/i18n.js'+import { t, tn } from '../lib/i18n.js'import { tappable } from '../lib/use-sheet-keyboard.js'import { Segmented } from './ui.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)} · ${t('{0} min', a.min)} · ${fmtVol(a.vol, S.unit)}` : '')}+ title={key + (a ? ` · ${tn('{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/components/Passkeys.jsx b/frontend/src/components/Passkeys.jsxindex 9e868d162..e4aff376c 100644--- a/frontend/src/components/Passkeys.jsx+++ b/frontend/src/components/Passkeys.jsx@@ -6,7 +6,7 @@import { useEffect, useRef, useState } from 'react'import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'-import { t } from '../lib/i18n.js'+import { t, tn } from '../lib/i18n.js'import { dateLocale } from '../lib/i18n-core.js'import { api, webauthnOK, createPasskey } from '../lib/api.js'import { copyText } from '../lib/clipboard.js'@@ -74,7 +74,7 @@ export function PasskeysRow({ state, changed }) {if (!state) return nullconst n = state.passkeys.lengthreturn <Row icon="lock" iconTint="var(--acc)" title={t('Passkeys')} accessory="chevron"- subtitle={n === 0 ? t('None yet — add one to sign in without your password.') : n === 1 ? t('1 passkey') : t('{0} passkeys', n)}+ subtitle={n === 0 ? t('None yet — add one to sign in without your password.') : tn('1 passkey', '{0} passkeys', n)}onClick={() => ui().openSheet(close => <PasskeysSheet close={close} changed={changed} />)} />}diff --git a/frontend/src/components/ServerSync.jsx b/frontend/src/components/ServerSync.jsxindex 07454bb17..f3c2c821e 100644--- a/frontend/src/components/ServerSync.jsx+++ b/frontend/src/components/ServerSync.jsx@@ -5,7 +5,7 @@import { useEffect, useState } from 'react'import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'-import { t } from '../lib/i18n.js'+import { t, tn } from '../lib/i18n.js'import { fmtAgo, changeCount } from '../lib/format.js'import { passkeyLogin, webauthnOK } from '../lib/api.js'import { MOBILE } from '../lib/mobile.js'@@ -207,7 +207,7 @@ export function OwedSheet({ kind, count: count0, media: media0 = 0, exportBackup{(count !== 0 || !media) && <div style={{ marginBottom: 6, fontWeight: 600 }}>{count > 0 ? t('Not on your server yet: {0}', changeCount(count)) : t('Some changes on this device have not reached your server.')}</div>}- {media > 0 && <div style={{ marginBottom: 6, fontWeight: 600 }}>{t(media === 1 ? '{0} photo or video has not reached your server yet.' : '{0} photos or videos have not reached your server yet.', media)}</div>}+ {media > 0 && <div style={{ marginBottom: 6, fontWeight: 600 }}>{tn('{0} photo or video has not reached your server yet.', '{0} photos or videos have not reached your server yet.', media)}</div>}{(tried || refused) && view && <div className="small" style={{ color: 'var(--red)', marginBottom: 6 }}>{view.line}</div>}{/* It names the button below it: Try again, or Pair again / Sign in where the server refuses. */}<div className="muted small" style={{ marginBottom: 18, lineHeight: 1.5 }}>diff --git a/frontend/src/lib/coach.js b/frontend/src/lib/coach.jsindex 5b13ab95d..719c96d5f 100644--- a/frontend/src/lib/coach.js+++ b/frontend/src/lib/coach.js@@ -18,7 +18,7 @@ import { uid, todayISO, DAYN } from './format.js'import { mergePlan } from './plan-share.js'import { deleteRoutine } from './routines.js'import { POLICIES } from './progression.js'-import { t } from './i18n.js'+import { t, tn } from './i18n.js'// Bumping this re-prompts everyone: it means what we share, or who we share it with, changed.export const CONSENT_VERSION = 1@@ -370,7 +370,7 @@ export function profileLines(p) {const lines = []if (goal) lines.push(t(goal))if (exp) lines.push(t(exp))- if (p.daysPerWeek) lines.push(p.daysPerWeek === 1 ? t('1 day a week') : t('{0} days a week', p.daysPerWeek))+ if (p.daysPerWeek) lines.push(tn('1 day a week', '{0} days a week', p.daysPerWeek))if (p.sessionMin) lines.push(t('{0} min per session', p.sessionMin))if (p.equipment?.length) lines.push(p.equipment.join(', '))if (p.limitations) lines.push(t('Limits: {0}', p.limitations))diff --git a/frontend/src/lib/format.js b/frontend/src/lib/format.jsindex 31a7f7c5d..f535edaa5 100644--- a/frontend/src/lib/format.js+++ b/frontend/src/lib/format.js@@ -1,5 +1,5 @@// Formatting + date helpers (ported from the vanilla app, unit taken from the store where needed).-import { dateLocale, t, exerciseNameFor, exerciseNameClass } from './i18n-core.js'+import { dateLocale, t, tn, exerciseNameFor, exerciseNameClass } from './i18n-core.js'export const todayISO = () => {const d = new Date()return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0')@@ -65,12 +65,12 @@ export const fmtPlate = n => (Math.round(n * 100) / 100).toLocaleString(dateLoca// 10 000 into "t", which is wrong for a pound profile and made one list mix "18.8t" with// "7'535 kg" — two numbers you can't compare at a glance.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)-export const changeCount = n => t(n === 1 ? '{0} change' : '{0} changes', n)+// Plural forms come from the pack via tn(): three forms in Russian, two in English.+export const exCount = n => tn('{0} exercise', '{0} exercises', n)+export const routineCount = n => tn('{0} routine', '{0} routines', n)+export const changeCount = n => tn('{0} change', '{0} changes', n)// The Sets tile of the finish summary: all the sets logged, then how many of them were work sets.-export const setsWorkCount = (n, work) => t(n === 1 ? '{0} set · {1} work' : '{0} sets · {1} work', n, work)+export const setsWorkCount = (n, work) => tn('{0} set · {1} work', '{0} sets · {1} work', n, work)// "5 minutes ago", "yesterday", "now" — in the UI language, from the platform's own rules// (Intl.RelativeTimeFormat), so no pack has to carry a word for every unit and plural. Used fordiff --git a/frontend/src/lib/i18n-core.js b/frontend/src/lib/i18n-core.jsindex 63b7fe0dc..93d255318 100644--- a/frontend/src/lib/i18n-core.js+++ b/frontend/src/lib/i18n-core.js@@ -74,6 +74,46 @@ export function t(s, ...args) {return v}+/* ------------------------------------------------------------------ plurals --+ English has two forms and the source strings are the keys, so a count used to be+ written `t(n === 1 ? '{0} set' : '{0} sets', n)` and every pack inherited that+ two-way split. Russian, Ukrainian and Polish have three (1 подход, 2 подхода,+ 5 подходов) and Arabic six, so those packs could only pick the least wrong of two+ — "2 подходов" — or dodge the grammar entirely, which is why the Russian pack+ reads "Упражнений: {0}" where a person would say "2 упражнения".++ The rule itself comes from the platform, the same way fmtAgo takes relative time+ from Intl.RelativeTimeFormat: no pack carries a rule, only its own forms. A pack+ answers a plural key with either a plain string (unchanged, still correct for every+ two-form language) or an object keyed by CLDR category:++ '{0} sets': { one: '{0} подход', few: '{0} подхода', many: '{0} подходов' }++ Keys stay the English plural, so a pack that says nothing new behaves as before. */+const pluralCategory = n => {+ try { return new Intl.PluralRules(dateLocale()).select(n) }+ catch { return n === 1 ? 'one' : 'other' }+}++/**+ * A translated count. `one` and `other` are the English source strings, as written at+ * the call site today; `n` picks the form. A pack entry that is an object supplies the+ * forms of the target language, falling back through `other` to the English pair.+ */+export function tn(one, other, n, ...rest) {+ const forms = dict[other]+ if (forms && typeof forms === 'object') {+ const form = forms[pluralCategory(n)] || forms.other || forms.many || forms.one+ if (form) {+ let v = form+ const args = [n, ...rest]+ for (let i = 0; i < args.length; i++) v = v.replaceAll('{' + i + '}', args[i])+ return v+ }+ }+ return t(n === 1 ? one : other, n, ...rest)+}+// Instructions for an exercise in the current language (English steps as fallback).export const instrFor = ex => (instr && instr[ex.id]) || ex.st || []diff --git a/frontend/src/lib/i18n-plural.test.js b/frontend/src/lib/i18n-plural.test.jsnew file mode 100644index 000000000..19b645c6c--- /dev/null+++ b/frontend/src/lib/i18n-plural.test.js@@ -0,0 +1,60 @@+import { describe, it, expect, afterEach } from 'vitest'+import { tn, _setLangState } from './i18n-core.js'+import ru from '../locales/ru.js'+import de from '../locales/de.js'++describe('tn() — plural forms from the pack', () => {+ afterEach(() => _setLangState('en', {}, null, null))++ it('falls back to the English two-form split with no pack', () => {+ _setLangState('en', {}, null, null)+ expect(tn('{0} exercise', '{0} exercises', 1)).toBe('1 exercise')+ expect(tn('{0} exercise', '{0} exercises', 2)).toBe('2 exercises')+ expect(tn('{0} exercise', '{0} exercises', 0)).toBe('0 exercises')+ })++ it('leaves a pack that answers with a plain string exactly as it was', () => {+ // German has two forms and says so with ordinary strings; nothing about it changes.+ _setLangState('de', de, null, null)+ expect(tn('{0} exercise', '{0} exercises', 1)).toBe(de['{0} exercise'].replace('{0}', 1))+ expect(tn('{0} exercise', '{0} exercises', 7)).toBe(de['{0} exercises'].replace('{0}', 7))+ })++ it('picks Russian one / few / many by the CLDR rule, not by n === 1', () => {+ _setLangState('ru', ru, null, null)+ const ex = n => tn('{0} exercise', '{0} exercises', n)+ expect(ex(1)).toBe('1 упражнение')+ expect(ex(2)).toBe('2 упражнения')+ expect(ex(4)).toBe('4 упражнения')+ expect(ex(5)).toBe('5 упражнений')+ expect(ex(0)).toBe('0 упражнений')+ // The teens are the trap: 11-14 take "many" even though 1-4 do not.+ expect(ex(11)).toBe('11 упражнений')+ expect(ex(14)).toBe('14 упражнений')+ expect(ex(21)).toBe('21 упражнение')+ expect(ex(22)).toBe('22 упражнения')+ expect(ex(25)).toBe('25 упражнений')+ expect(ex(101)).toBe('101 упражнение')+ })++ it('fills every placeholder, not just the count', () => {+ _setLangState('ru', ru, null, null)+ expect(tn('{0} set · {1} work', '{0} sets · {1} work', 2, 3)).toBe('2 подхода · 3 рабочих')+ expect(tn('{0} set · {1} work', '{0} sets · {1} work', 5, 4)).toBe('5 подходов · 4 рабочих')+ })++ it('reads the forms off the plural key, so a singular-only key needs no entry', () => {+ _setLangState('ru', ru, null, null)+ // '1 day a week' carries no {0} and has no entry of its own; the plural key answers for it.+ expect(tn('1 day a week', '{0} days a week', 1)).toBe('1 день в неделю')+ expect(tn('1 day a week', '{0} days a week', 3)).toBe('3 дня в неделю')+ })++ it('has a form for every plural key the Russian pack declares', () => {+ for (const [key, value] of Object.entries(ru)) {+ if (!value || typeof value !== 'object') continue+ expect(Object.keys(value), key).toEqual(expect.arrayContaining(['one', 'few', 'many']))+ for (const form of Object.values(value)) expect(typeof form, key).toBe('string')+ }+ })+})diff --git a/frontend/src/lib/i18n.js b/frontend/src/lib/i18n.jsindex bc473caca..1b927ea18 100644--- a/frontend/src/lib/i18n.js+++ b/frontend/src/lib/i18n.js@@ -6,13 +6,13 @@import { useSyncExternalStore } from 'react'import {LANGS, INSTR_LANGS, EXERCISE_NAME_LANGS, DATE_LOCALES, DERIVED_LOCALES, RTL_LANGS,- getLang, dateLocale, t, instrFor, exerciseNameFor, exerciseNameSearchText, getVersion,+ getLang, dateLocale, t, tn, instrFor, exerciseNameFor, exerciseNameSearchText, getVersion,baseLang, derivePack, _setLangState, exerciseNameClass} from './i18n-core.js'export {LANGS, INSTR_LANGS, EXERCISE_NAME_LANGS, DATE_LOCALES, DERIVED_LOCALES, RTL_LANGS,- getLang, dateLocale, t, instrFor, exerciseNameFor, exerciseNameSearchText, exerciseNameClass, baseLang+ getLang, dateLocale, t, tn, instrFor, exerciseNameFor, exerciseNameSearchText, exerciseNameClass, baseLang}// Vite code-splits locale, instruction and exercise-name packs via import.meta.glob. They arediff --git a/frontend/src/lib/mobile.js b/frontend/src/lib/mobile.jsindex 6f5da81e2..ae1fcde46 100644--- a/frontend/src/lib/mobile.js+++ b/frontend/src/lib/mobile.js@@ -9,7 +9,7 @@//// Like the demo build, MOBILE is replaced at build time, so all of this folds away in// web bundles; the Capacitor plugins are only ever imported behind it.-import { t } from './i18n-core.js'+import { t, tn } from './i18n-core.js'import { isoOf, todayISO } from './format.js'import { effectiveRoutineIds } from './history.js'@@ -111,7 +111,7 @@ export function buildReminderNotifications(S, now = new Date()) {// A weekday can hold several routines; name them all, or fall back to a count.const dayRoutines = effectiveRoutineIds(state, iso).map(id => routines.find(x => x.id === id)).filter(Boolean)if (!dayRoutines.length) continue- const label = dayRoutines.length <= 2 ? dayRoutines.map(r => r.name).join(' + ') : t('{0} routines', dayRoutines.length)+ const label = dayRoutines.length <= 2 ? dayRoutines.map(r => r.name).join(' + ') : tn('{0} routine', '{0} routines', dayRoutines.length)const at = new Date(day)at.setHours(hour, minute, 0, 0)if (at <= now) continuediff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 2df1568f7..e4de31e4a 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -83,8 +83,6 @@ export default {'Add “{0}”': 'Добавить «{0}»','“{0}” added to {1}': '«{0}» добавлено в {1}','Pick a routine — sets, reps & weight come next.': 'Выбери программу — подходы, повторения и вес будут дальше.',- '{0} exercises': 'Упражнений: {0}',- '{0} exercise': 'Упражнение: {0}','already in': 'уже есть','Create one and start with this exercise': 'Создай новую и начни с этого упражнения','Add exercise': 'Добавить упражнение',@@ -129,8 +127,6 @@ export default {'Rest / skip this day': 'Отдых / пропустить день','Rest day': 'День отдыха','Next session: {0}, {1}': 'Следующая тренировка: {0}, {1}',- '{0} workout': 'Тренировок: {0}',- '{0} workouts': 'Тренировок: {0}','No workouts this month': 'В этом месяце тренировок нет','Trained': 'Тренировка','Planned': 'Запланировано',@@ -168,8 +164,6 @@ export default {'You haven’t checked off any sets. Finish the workout anyway?': 'Ни один подход не отмечен. Всё равно завершить тренировку?','Finish anyway': 'Всё равно завершить','Finish early?': 'Завершить раньше?',- '{0} set still unchecked. Finish the workout now?': 'Не отмечен {0} подход. Завершить сейчас?',- '{0} sets still unchecked. Finish the workout now?': 'Не отмечено подходов: {0}. Завершить сейчас?','Finish workout': 'Завершить тренировку','Start workout': 'Начать тренировку','today is {0}': 'сегодня — {0}',@@ -239,8 +233,6 @@ export default {'Build my own plan': 'Создать свой план','{0} week streak': 'серия: {0} нед.','this week': 'на этой неделе',- '{0} workout total': 'всего тренировок: {0}',- '{0} workouts total': 'всего тренировок: {0}','Progress & history': 'Прогресс и история','Workouts': 'Тренировки','This month': 'Этот месяц',@@ -360,7 +352,6 @@ export default {'This account has been disabled.': 'Эта учётная запись отключена.','The server is busy — try again in a moment.': 'Сервер занят — попробуй ещё раз чуть позже.',// --- more passkeys, one-time codes for another device (#95) ---- '1 passkey': '1 ключ доступа','A one-time code lets your phone or another computer sign in with a passkey of its own.': 'Одноразовый код позволяет твоему телефону или другому компьютеру входить со своим ключом доступа.','Add a passkey': 'Добавить ключ доступа','Add another device': 'Добавить другое устройство',@@ -403,7 +394,6 @@ export default {'Use a code from your other device': 'Использовать код с другого устройства','You get a code that lets your phone or another computer create a passkey for this profile. First confirm that it is you.': 'Ты получишь код, с которым твой телефон или другой компьютер сможет создать ключ доступа для этого профиля. Сначала подтверди, что это ты.','or with your password': 'или своим паролем',- '{0} passkeys': 'Ключей доступа: {0}','Each profile keeps its own plan, workouts & body weight.': 'У каждого профиля свой план, тренировки и вес тела.','Account': 'Аккаунт','Sign out?': 'Выйти?',@@ -681,17 +671,11 @@ export default {'{0}’s plan': 'План: {0}','Import “{0}”': 'Импортировать «{0}»','Import this plan': 'Импортировать этот план',- '{0} routine': 'Программа: {0}',- '{0} routines': 'Программ: {0}',- 'scheduled on {0} days': 'запланировано на {0} дней',- 'scheduled on {0} day': 'запланировано на {0} день','These are added as new routines — nothing you already have is changed.': 'Они добавляются как новые программы — ничего из того, что у тебя уже есть, не меняется.','{0} exercise in the file isn’t in your library and was left out.': '{0} упражнение из файла отсутствует в вашей библиотеке и было пропущено.','{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': 'Общая программа','Unknown exercise': 'Неизвестное упражнение',@@ -706,8 +690,6 @@ export default {'Top set': 'Лучший подход','Est. 1RM': 'Расч. 1ПМ','No sessions logged yet': 'Записанных сессий пока нет',- '{0} session': '{0} сессия',- '{0} sessions': '{0} сессий','Exercise history': 'История упражнения','Last {0} sessions': 'Последние {0} сессий','Estimated 1RM': 'Расчётный 1ПМ',@@ -853,7 +835,6 @@ export default {'Controls': 'Управление','Undo the last Coach changes': 'Отменить последние изменения Тренера','Turn the Coach off': 'Выключить Тренера',- '{0} days a week': '{0} дней в неделю','{0} min': '{0} мин','{0}h {1}m': '{0} ч {1} мин','The Coach is on': 'Тренер включён',@@ -966,7 +947,6 @@ export default {'Remove a routine': 'Удалить программу','Rename routine to “{0}”': 'Переименовать программу в «{0}»','Change what’s planned on one day': 'Изменить план на один из дней',- '{0} sets · {1} work': '{0} подходов · {1} рабочих','Make superset with previous': 'Суперсет с предыдущим','Make superset with next': 'Суперсет со следующим','primary': 'основная',@@ -1136,7 +1116,6 @@ export default {'here when you need it': 'здесь, когда нужен','thinking…': 'думает…','{0} min per session': '{0} мин за тренировку',- '1 day a week': '1 день в неделю','How did my {0} session go?': 'Как прошла моя сессия {0}?','How did my last workout go?': 'Как прошла моя последняя тренировка?','Focus only on my routine “{0}”. Improve it: exercise choice, order, sets and reps, rep ranges, progression. Leave the other routines alone.': 'Сосредоточься только на моей программе «{0}». Улучши её: выбор упражнений, порядок, подходы и повторения, диапазоны повторений, прогрессия. Остальные программы не трогай.',@@ -1212,14 +1191,6 @@ export default {'You': 'Ты','Median': 'Медиана','No exercise is trained by three or more people yet.': 'Пока ни одно упражнение не делают трое и больше.',- 'Applied {0} change to your plan.': 'В план внесено {0} изменение.',- 'Applied {0} changes to your plan.': 'В план внесено {0} изменений.',- '{0} change applied': '{0} изменение применено',- '{0} changes applied': '{0} изменений применено',- '{0} suggestion': '{0} предложение',- '{0} suggestions': '{0} предложений',- 'Apply {0} change': 'Применить {0} изменение',- 'Apply {0} changes': 'Применить {0} изменений','Neck': 'Шея','Arms': 'Руки','Legs': 'Ноги',@@ -1446,8 +1417,6 @@ export default {'Your data is removed from this browser; your profile on the server keeps it. First it checks that the server has every change — if not, you choose what happens to them.': 'Ваши данные будут удалены из этого браузера; ваш профиль на сервере их сохранит. Сначала проверяется, что на сервере есть все изменения, — если нет, вы сами решаете, что с ними делать.','Signs this profile out on every device, including this one. Phones paired with it are disconnected and have to be paired again. Your passkeys keep working — sign in with them again anytime.': 'Выполняет выход из этого профиля на всех устройствах, включая это. Сопряжённые с ним телефоны отключаются, и их нужно будет сопрячь заново. Ваши ключи доступа продолжают работать — входите с ними снова в любое время.','Open Settings → “Pair the mobile app” on your openGym site in a browser and enter the new code shown there. What this phone kept is merged into your account.': 'Откройте Настройки → «Сопряжение мобильного приложения» на своём сайте openGym в браузере и введите показанный там новый код. То, что сохранил этот телефон, будет объединено с вашим аккаунтом.',- '{0} change': '{0} изменение',- '{0} changes': 'изменений: {0}',// --- plan vs session: the routine's own reps, per-routine progress (#275, #216) ---'Planned sessions start from': 'Основа запланированных тренировок','The routine’s sets and reps. Your history decides the weight.': 'Подходы и повторения из программы. Вес определяет ваша история.',@@ -1518,8 +1487,6 @@ export default {'Mark all sets done': 'Отметить все подходы выполненными',// --- every weigh-in, week by week ---'All weigh-ins': 'Все взвешивания',- '{0} weigh-in': 'Взвешиваний: {0}',- '{0} weigh-ins': 'Взвешиваний: {0}','Weekly average': 'Среднее за неделю','Week of {0}': 'Неделя с {0}','Average {0}': 'В среднем {0}',@@ -1576,7 +1543,6 @@ export default {'Server address unknown': 'Адрес сервера неизвестен','Pair again, or export a backup first. Going ahead anyway keeps a copy of these changes on this device until it connects to this server as this account again — then they are added back.': 'Выполните сопряжение заново или сначала экспортируйте резервную копию. Если всё равно продолжить, копия этих изменений останется на этом устройстве, пока оно снова не подключится к этому серверу с этим аккаунтом, — тогда они будут добавлены обратно.','Sign in again, or export a backup first. Going ahead anyway keeps a copy of these changes on this device until it connects to this server as this account again — then they are added back.': 'Войдите снова или сначала экспортируйте резервную копию. Если всё равно продолжить, копия этих изменений останется на этом устройстве, пока оно снова не подключится к этому серверу с этим аккаунтом, — тогда они будут добавлены обратно.',- '{0} set · {1} work': '{0} подход · рабочих: {1}','Every exercise in this workout': 'Все упражнения этой тренировки','No sets are left in this workout, so there is nothing to save. Delete it from your history?': 'В этой тренировке не осталось ни одного подхода, сохранять нечего. Удалить её из истории?',// --- a custom exercise's own photo, GIF or video, and its link ---@@ -1604,13 +1570,9 @@ export default {'{0} of {1} MB used on your server': 'Занято на вашем сервере: {0} из {1} МБ','{0} waiting to upload': 'Ожидают загрузки: {0}','Export with photos & videos (.zip)': 'Экспорт с фото и видео (.zip)',- '{0} files could not be included': 'Не удалось добавить файлов: {0}',- '{0} file could not be included': 'Не удалось добавить {0} файл','Without photos and videos': 'Без фото и видео','Name it and pick a body part — it behaves like any other exercise.': 'Дайте название и выберите часть тела — упражнение работает как любое другое.','name + body part, and a photo or video if you like': 'название + часть тела и, по желанию, фото или видео',- '{0} photos or videos have not reached your server yet.': 'Фото и видео, ещё не попавшие на ваш сервер: {0}.',- '{0} photo or video has not reached your server yet.': 'Фото или видео, ещё не попавшее на ваш сервер: {0}.',// --- a logged workout's own photos and videos ---'Add photo or video': 'Добавить фото или видео','Up to {0} photos or videos per workout.': 'Не больше {0} фото или видео на тренировку.',@@ -1619,12 +1581,6 @@ export default {'Remove this photo or video?': 'Удалить это фото или видео?','Close': 'Закрыть','Previous': 'Назад',- '{0} photo or video': 'Фото или видео: {0}',- '{0} photos or videos': 'Фото и видео: {0}',- 'Its photo or video is deleted with it.': 'Фото или видео тоже будет удалено.',- 'Its {0} photos or videos are deleted with it.': 'Фото и видео ({0}) тоже будут удалены.',- 'Its photo or video moves to the new workout.': 'Фото или видео перейдёт в новую тренировку.',- 'Its {0} photos or videos move to the new workout.': 'Фото и видео ({0}) перейдут в новую тренировку.','The server has 1 workout that is not in this backup, logged since it was made or on another device. Replacing deletes it.': 'На сервере есть 1 тренировка, которой нет в этой копии: записана позже или на другом устройстве. Замена её удалит.','The server has {0} workouts that are not in this backup, logged since it was made or on another device. Replacing deletes them.': 'На сервере есть тренировки, которых нет в этой копии ({0}): записаны позже или на другом устройстве. Замена их удалит.','Replace anyway': 'Всё равно заменить',@@ -1663,4 +1619,52 @@ export default {'Teal': 'Бирюзовый','Yellow': 'Жёлтый','Enter how long it took — at least 1 minute.': 'Укажите, сколько это длилось — не меньше 1 минуты.',+ // --- plural forms, read by tn(). Russian needs three where English has two, so these+ // --- keys answer with the forms instead of one string. The key stays the English plural.+ '{0} exercises': { one: '{0} упражнение', few: '{0} упражнения', many: '{0} упражнений' },+ '{0} routines': { one: '{0} программа', few: '{0} программы', many: '{0} программ' },+ '{0} changes': { one: '{0} изменение', few: '{0} изменения', many: '{0} изменений' },+ '{0} changes applied': { one: 'Применено {0} изменение', few: 'Применено {0} изменения', many: 'Применено {0} изменений' },+ '{0} sets · {1} work': { one: '{0} подход · {1} рабочих', few: '{0} подхода · {1} рабочих', many: '{0} подходов · {1} рабочих' },+ '{0} workouts': { one: '{0} тренировка', few: '{0} тренировки', many: '{0} тренировок' },+ '{0} workouts total': { one: 'всего {0} тренировка', few: 'всего {0} тренировки', many: 'всего {0} тренировок' },+ '{0} sessions': { one: '{0} сессия', few: '{0} сессии', many: '{0} сессий' },+ '{0} weigh-ins': { one: '{0} взвешивание', few: '{0} взвешивания', many: '{0} взвешиваний' },+ '{0} suggestions': { one: '{0} предложение', few: '{0} предложения', many: '{0} предложений' },+ '{0} days a week': { one: '{0} день в неделю', few: '{0} дня в неделю', many: '{0} дней в неделю' },+ '{0} passkeys': { one: '{0} ключ доступа', few: '{0} ключа доступа', many: '{0} ключей доступа' },+ '{0} photos or videos': { one: '{0} фото или видео', few: '{0} фото или видео', many: '{0} фото или видео' },+ '{0} files could not be included': { one: '{0} файл не удалось включить', few: '{0} файла не удалось включить', many: '{0} файлов не удалось включить' },+ 'scheduled on {0} days': { one: 'запланировано на {0} день', few: 'запланировано на {0} дня', many: 'запланировано на {0} дней' },+ 'Added {0} routines to your plan': { one: 'В план добавлена {0} программа', few: 'В план добавлено {0} программы', many: 'В план добавлено {0} программ' },+ 'Applied {0} changes to your plan.': { one: 'В план внесено {0} изменение.', few: 'В план внесено {0} изменения.', many: 'В план внесено {0} изменений.' },+ 'Apply {0} changes': { one: 'Применить {0} изменение', few: 'Применить {0} изменения', many: 'Применить {0} изменений' },+ '{0} sets still unchecked. Finish the workout now?': { one: 'Не отмечен {0} подход. Завершить тренировку?', few: 'Не отмечено {0} подхода. Завершить тренировку?', many: 'Не отмечено {0} подходов. Завершить тренировку?' },+ '{0} photos or videos have not reached your server yet.': { one: '{0} фото или видео ещё не дошло до вашего сервера.', few: '{0} фото или видео ещё не дошли до вашего сервера.', many: '{0} фото или видео ещё не дошли до вашего сервера.' },+ 'Its {0} photos or videos are deleted with it.': { one: 'Вместе с ней удалится {0} фото или видео.', few: 'Вместе с ней удалятся {0} фото или видео.', many: 'Вместе с ней удалятся {0} фото или видео.' },+ 'Its {0} photos or videos move to the new workout.': { one: 'Её {0} фото или видео перейдёт к новой тренировке.', few: 'Её {0} фото или видео перейдут к новой тренировке.', many: 'Её {0} фото или видео перейдут к новой тренировке.' },+ // --- singular strings kept for pack parity: tn() reads the plural key, but every other+ // --- pack still carries these and check-locales.mjs compares the union of all packs.+ '{0} exercise': 'Упражнение: {0}',+ '{0} workout': 'Тренировок: {0}',+ '{0} set still unchecked. Finish the workout now?': 'Не отмечен {0} подход. Завершить сейчас?',+ '{0} workout total': 'всего тренировок: {0}',+ '1 passkey': '1 ключ доступа',+ '{0} routine': 'Программа: {0}',+ 'scheduled on {0} day': 'запланировано на {0} день',+ 'Added {0} routine to your plan': 'В твой план добавлена {0} программа',+ '{0} session': '{0} сессия',+ '1 day a week': '1 день в неделю',+ 'Applied {0} change to your plan.': 'В план внесено {0} изменение.',+ '{0} change applied': '{0} изменение применено',+ '{0} suggestion': '{0} предложение',+ 'Apply {0} change': 'Применить {0} изменение',+ '{0} change': '{0} изменение',+ '{0} weigh-in': 'Взвешиваний: {0}',+ '{0} set · {1} work': '{0} подход · рабочих: {1}',+ '{0} file could not be included': 'Не удалось добавить {0} файл',+ '{0} photo or video has not reached your server yet.': 'Фото или видео, ещё не попавшее на ваш сервер: {0}.',+ '{0} photo or video': 'Фото или видео: {0}',+ 'Its photo or video is deleted with it.': 'Фото или видео тоже будет удалено.',+ 'Its photo or video moves to the new workout.': 'Фото или видео перейдёт в новую тренировку.',}diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 71020da59..382e370aa 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -9,7 +9,7 @@ import { usesBar, defaultBarWeight, hasBarOverride, isNoBar } from './lib/bar.jsimport { PLATE_SIZES, pairsOf, ownsPlates, withPlatePairs, withStandardPlates, withLoadKind, loadKindFor, baseWeightFor, dropGrid } from './lib/plates.js'import { toScale, rirOf, EFFORT_PRESETS, effortColor } from './lib/effort.js'import { beep, vibrate } from './lib/sound.js'-import { t, dateLocale, instrFor, exerciseNameFor, exerciseNameClass, getLang, INSTR_LANGS } from './lib/i18n.js'+import { t, tn, dateLocale, instrFor, exerciseNameFor, exerciseNameClass, getLang, INSTR_LANGS } from './lib/i18n.js'import { nav } from './lib/nav.js'import { buildStarterPlan, starterPlanDays, starterPlanOptions } from './lib/starter.js'import Media, { Thumb } from './components/Media.jsx'@@ -316,7 +316,7 @@ function WeighIns() {</>return <><h3 style={{ marginBottom: 2 }}>{t('Weigh-ins')}</h3>- <div className="muted small" style={{ marginBottom: 10 }}>{t(n === 1 ? '{0} weigh-in' : '{0} weigh-ins', n)}</div>+ <div className="muted small" style={{ marginBottom: 10 }}>{tn('{0} weigh-in', '{0} weigh-ins', n)}</div><div className="chart"><LineChart points={points} h={140} unit={st.unit} goal={st.targetW} /></div><div className="small dim" style={{ marginTop: 6 }}>{t('Weekly average')}</div>{weeks.map(w => {@@ -866,7 +866,7 @@ function ExerciseHistory({ exId }) {].filter(Boolean).join(' · ')return <><h3 className={exerciseNameClass(ex)} style={{ marginBottom: 2 }}>{exerciseNameFor(ex)}</h3>- <div className="muted small" style={{ marginBottom: 10 }}>{t('Exercise history')} · {t(h.total === 1 ? '{0} session' : '{0} sessions', h.total)}</div>+ <div className="muted small" style={{ marginBottom: 10 }}>{t('Exercise history')} · {tn('{0} session', '{0} sessions', h.total)}</div>{/* Only reps work with a load produces an estimate, so the toggle is absent for the rest. */}{h.e1rmPoints.length > 0 && h.metric === 'weight' && <Segmented className="seg-range" value={curve} onChange={setCurve}options={[{ value: 'top', label: t('Top set') }, { value: 'e1rm', label: t('Est. 1RM') }]} />}@@ -1779,7 +1779,7 @@ function PlanImport({ bundle, close }) {const apply = () => {update(s => mergePlan(s, bundle, { schedule }))close()- toast(t(bundle.routineCount === 1 ? 'Added {0} routine to your plan' : 'Added {0} routines to your plan', bundle.routineCount))+ toast(tn('Added {0} routine to your plan', 'Added {0} routines to your plan', bundle.routineCount))nav('/plan')}return <>@@ -1788,7 +1788,7 @@ function PlanImport({ bundle, close }) {{routineCount(bundle.routineCount)}{' · ' + exCount(bundle.exerciseCount)}{bundle.scheduledDays > 0- ? ' · ' + t(bundle.scheduledDays === 1 ? 'scheduled on {0} day' : 'scheduled on {0} days', bundle.scheduledDays)+ ? ' · ' + tn('scheduled on {0} day', 'scheduled on {0} days', bundle.scheduledDays): ''}</div><div className="dim small" style={{ marginBottom: 14, lineHeight: 1.4 }}>{t('These are added as new routines — nothing you already have is changed.')}</div>@@ -2097,7 +2097,7 @@ function WorkoutDetail({ w, close }) {// record lists, shown or not. Empty when it has none.function mediaGoesToo(rec) {const n = workoutMediaOf(rec, Infinity).length- return n ? ' ' + t(n === 1 ? 'Its photo or video is deleted with it.' : 'Its {0} photos or videos are deleted with it.', n) : ''+ return n ? ' ' + tn('Its photo or video is deleted with it.', 'Its {0} photos or videos are deleted with it.', n) : ''}export const workoutDetailSheet = w => ui().openSheet(close => <WorkoutDetail w={w} close={close} />)@@ -2136,7 +2136,7 @@ function Calendar({ start, close }) {<h3 style={{ margin: 0 }}>{t(MONTHS_LONG[mo])} {y}</h3><button className="iconbtn" onClick={() => setCur(new Date(y, mo + 1, 1))} aria-label={t('Next month')}><Icon name="chevronRight" /></button></div>- <div className="small muted" style={{ textAlign: 'center' }}>{monthWs.length ? `${t(monthWs.length === 1 ? '{0} workout' : '{0} workouts', monthWs.length)} · ${fmtDur(monthMs)} · ${fmtVol(monthVol, st.unit)}` : t('No workouts this month')}</div>+ <div className="small muted" style={{ textAlign: 'center' }}>{monthWs.length ? `${tn('{0} workout', '{0} workouts', monthWs.length)} · ${fmtDur(monthMs)} · ${fmtVol(monthVol, st.unit)}` : t('No workouts this month')}</div><div className="cal-grid">{weekOrder(ws).map(d => <div key={d} className="cal-h">{t(DAYS[d])}</div>)}{cells}</div><div className="cal-legend"><span><i style={{ background: 'var(--acc)' }} />{t('Trained')}</span>@@ -2157,7 +2157,7 @@ export function WorkoutRow({ w, onClick }) {<span className="lrow-i" style={{ width: 34, height: 34, borderRadius: 8, fontSize: 19 }}><Icon name={glyph} /></span><div className="grow"><div className="tt">{w.name}</div><div className="ss">{[fmtDate(w.d, true), ...durPart(w.end - w.start), t('{0} sets', setsDone(w)), fmtVol(w.vol, st.unit)].join(' · ')}</div></div>- {mediaN > 0 && <span className="wrow-media" title={t(mediaN === 1 ? '{0} photo or video' : '{0} photos or videos', mediaN)} aria-label={t(mediaN === 1 ? '{0} photo or video' : '{0} photos or videos', mediaN)}><Icon name="image" />{mediaN}</span>}+ {mediaN > 0 && <span className="wrow-media" title={tn('{0} photo or video', '{0} photos or videos', mediaN)} aria-label={tn('{0} photo or video', '{0} photos or videos', mediaN)}><Icon name="image" />{mediaN}</span>}{w.prs && w.prs.length > 0 && <span className="pr"><Icon name="trophy" />{w.prs.length} PR</span>}<Icon name="chevronRight" className="chev" /></div>@@ -2255,7 +2255,7 @@ function SameDayChoice({ iso, existing, onReplace, onAdd, close }) {const n = workoutMediaOf(w, Infinity).lengthreturn <div key={w.id} style={{ marginBottom: 8 }}><button className="btn danger" onClick={() => onReplace(w.id)}>{existing.length > 1 ? t('Replace') + ' · ' + w.name : t('Replace')}</button>- {n > 0 && <div className="small dim samed-media" style={{ marginTop: 4 }}>{t(n === 1 ? 'Its photo or video moves to the new workout.' : 'Its {0} photos or videos move to the new workout.', n)}</div>}+ {n > 0 && <div className="small dim samed-media" style={{ marginTop: 4 }}>{tn('Its photo or video moves to the new workout.', 'Its {0} photos or videos move to the new workout.', n)}</div>}</div>})}<button className="btn primary" onClick={onAdd}>{t('Add as second workout')}</button>@@ -2632,7 +2632,7 @@ export function finishWorkout() {const done = setsDoneActive(A)const total = setUnitsTotal(A.entries)if (!done) { confirmSheet({ title: t('Nothing logged yet'), message: t('You haven’t checked off any sets. Finish the workout anyway?'), confirmText: t('Finish anyway'), onConfirm: doFinishWorkout }); return }- if (done < total) { confirmSheet({ title: t('Finish early?'), message: t(total - done === 1 ? '{0} set still unchecked. Finish the workout now?' : '{0} sets still unchecked. Finish the workout now?', total - done), confirmText: t('Finish workout'), onConfirm: doFinishWorkout }); return }+ if (done < total) { confirmSheet({ title: t('Finish early?'), message: tn('{0} set still unchecked. Finish the workout now?', '{0} sets still unchecked. Finish the workout now?', total - done), confirmText: t('Finish workout'), onConfirm: doFinishWorkout }); return }doFinishWorkout()}function doFinishWorkout() {diff --git a/frontend/src/views/CoachChat.jsx b/frontend/src/views/CoachChat.jsxindex f1aafe166..9f79bc7e7 100644--- a/frontend/src/views/CoachChat.jsx+++ b/frontend/src/views/CoachChat.jsx@@ -16,7 +16,7 @@ import { useEffect, useMemo, useRef, useState } from 'react'import { useNavigate } from 'react-router-dom'import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'-import { t } from '../lib/i18n.js'+import { t, tn } from '../lib/i18n.js'import { fmtDate, fmtNum, DAYS, weekOrder, weekStartOf } from '../lib/format.js'import { exLine } from '../lib/history.js'import { speedUnitOf } from '../lib/speed.js'@@ -140,7 +140,7 @@ export default function CoachChat() {const pickRoutine = () => openSheet(close => <div className="chat-menu"><h3>{t('Improve which routine?')}</h3><div className="sect-b">- {(S.routines || []).map(r => <Row key={r.id} icon={glyphOf(r.emoji)} iconTint="var(--acc)" title={r.name} subtitle={t('{0} exercises', (r.ex || []).length)} accessory="chevron" onClick={() => { close(); askImprove(r) }} />)}+ {(S.routines || []).map(r => <Row key={r.id} icon={glyphOf(r.emoji)} iconTint="var(--acc)" title={r.name} subtitle={tn('{0} exercise', '{0} exercises', (r.ex || []).length)} accessory="chevron" onClick={() => { close(); askImprove(r) }} />)}{!(S.routines || []).length && <div className="chat-empty">{t('You have no routines yet — ask the Coach for a plan first.')}</div>}</div><div style={{ height: 10 }} />@@ -362,7 +362,7 @@ const WeekStrip = ({ days, ws }) => <div className="pcard-week"></div>const RoutineBlock = ({ r, unit, speedUnit }) => <div className="pcard-rt">- <div className="pcard-rt-h"><b><Icon name={glyphOf(r.emoji)} />{r.name}</b><span>{t('{0} exercises', r.ex.length)}</span></div>+ <div className="pcard-rt-h"><b><Icon name={glyphOf(r.emoji)} />{r.name}</b><span>{tn('{0} exercise', '{0} exercises', r.ex.length)}</span></div>{!!r.why && <div className="pcard-why">{r.why}</div>}{r.ex.map((e, i) => <div key={i} className="pcard-ex"><div className="pcard-ex-r"><span className="pcard-ex-n">{exName(e.id)}</span><span className="pcard-ex-l">{exLine(e, unit, speedUnit)}</span></div>@@ -384,10 +384,10 @@ function ReviewCard({ p, S, update, toast, refresh }) {try {update(s => {const res = applyChangeSet(s, marked, ids)- appendChat(s, { role: 'coach', kind: 'applied', ref: res.logId, text: t(ids.length === 1 ? 'Applied {0} change to your plan.' : 'Applied {0} changes to your plan.', ids.length) })+ appendChat(s, { role: 'coach', kind: 'applied', ref: res.logId, text: tn('Applied {0} change to your plan.', 'Applied {0} changes to your plan.', ids.length) })})resolvePending({ accepted: ids, rejected: marked.changes.filter(c => !ids.includes(c.id)).map(c => c.id) }).catch(() => {})- toast(t(ids.length === 1 ? '{0} change applied' : '{0} changes applied', ids.length))+ toast(tn('{0} change applied', '{0} changes applied', ids.length))refresh()} catch (e) { toast(e.message || t('Could not apply those changes')) }}@@ -405,7 +405,7 @@ function ReviewCard({ p, S, update, toast, refresh }) {<div className="pcard"><div className="pcard-hd"><div className="pcard-eyebrow">{t('Suggestions')}</div>- <h2 className="pcard-h">{t(marked.changes.length === 1 ? '{0} suggestion' : '{0} suggestions', marked.changes.length)}</h2>+ <h2 className="pcard-h">{tn('{0} suggestion', '{0} suggestions', marked.changes.length)}</h2>{!!marked.summary && <p className="pcard-sum">{marked.summary}</p>}{!!marked.evidence?.sessions && <p className="pcard-sum" style={{ fontSize: 13 }}>{t('Based on your last {0} sessions', marked.evidence.sessions)}{marked.evidence.from ? ` · ${fmtDate(marked.evidence.from)} – ${fmtDate(marked.evidence.to)}` : ''}@@ -429,7 +429,7 @@ function ReviewCard({ p, S, update, toast, refresh }) {<div className="pcard-note">{t('The Coach is not a doctor or a physiotherapist. If something hurts, ask a professional.')}</div><div className="pcard-ft"><Button variant="primary" icon="check" onClick={apply}>- {accepted.size ? t(accepted.size === 1 ? 'Apply {0} change' : 'Apply {0} changes', accepted.size) : t('Apply nothing')}+ {accepted.size ? tn('Apply {0} change', 'Apply {0} changes', accepted.size) : t('Apply nothing')}</Button><Button onClick={discard}>{t('Dismiss all')}</Button></div>@@ -593,7 +593,7 @@ function Recap({ entry, S, openSheet }) {: rej ? { cls: 'mix', text: t('{0} accepted · {1} declined', acc, rej) } : { cls: 'yes', text: t('{0} accepted', acc) }const title = kind === 'create' ? (entry.bundle?.name || t('Coach plan')): kind === 'debrief' ? (entry.workout?.name || t('Workout')) + (entry.score != null ? ` · ${entry.score}/10` : '')- : t(decisions.length === 1 ? '{0} suggestion' : '{0} suggestions', decisions.length)+ : tn('{0} suggestion', '{0} suggestions', decisions.length)return <button className="recap" onClick={open}><div className="recap-top"><span className="pcard-eyebrow">{eyebrow}</span>@@ -619,7 +619,7 @@ function ProposalDetail({ entry, S }) {return <div className="pdetail"><div className="pcard-hd" style={{ paddingInline: 0 }}><div className="pcard-eyebrow">{kind === 'create' ? t('Plan') : kind === 'debrief' ? t('Workout debrief') : t('Suggestions')} · {fmtDate(new Date(entry.at).toISOString().slice(0, 10))}</div>- <h2 className="pcard-h">{kind === 'create' ? (b?.name || t('Coach plan')) : kind === 'debrief' ? (entry.workout?.name || t('Workout')) : t(entry.decisions?.length === 1 ? '{0} suggestion' : '{0} suggestions', entry.decisions?.length || 0)}</h2>+ <h2 className="pcard-h">{kind === 'create' ? (b?.name || t('Coach plan')) : kind === 'debrief' ? (entry.workout?.name || t('Workout')) : tn('{0} suggestion', '{0} suggestions', entry.decisions?.length || 0)}</h2>{!!entry.summary && <p className="pcard-sum">{entry.summary}</p>}{entry.dismissed && <p className="pcard-sum" style={{ color: 'var(--red)' }}>{t('You declined this.')}</p>}{!!entry.evidence?.sessions && <p className="pcard-sum" style={{ fontSize: 13 }}>@@ -665,7 +665,7 @@ function HistorySheet({ S, close, openSheet }) {const title = e.kind === 'create' ? (e.bundle?.name || t('Coach plan')) + (e.iteration > 1 ? ` · ${t('Revision {0}', e.iteration)}` : ''): e.kind === 'debrief' ? t('Debrief: {0}', e.workout?.name || t('Workout')) + (e.score != null ? ` · ${e.score}/10` : ''): e.kind === 'revert' ? t('Reverted the last Coach changes.')- : t(n === 1 ? '{0} suggestion' : '{0} suggestions', n)+ : tn('{0} suggestion', '{0} suggestions', n)const sub = fmtDate(new Date(e.at).toISOString().slice(0, 10)) + ' · ' + (e.kind === 'debrief' ? String(e.summary || '').slice(0, 60): e.dismissed ? t('Declined') : e.kind === 'create' ? t('Imported') : e.kind === 'revert' ? '' : t('{0} accepted · {1} declined', acc, n - acc))return <Row key={e.id} icon={ic} iconTint={tint} title={title} subtitle={sub} accessory="chevron"@@ -772,7 +772,7 @@ function CadenceSheet({ update }) {{mode === 'every' && <SelectRow icon="dumbbell" iconTint="var(--teal)" title={t('After how many workouts')}value={cadence.everyWorkouts || 4}onChange={v => patch(c => { c.cadence = { everyWorkouts: v } })}- options={[3, 4, 5, 6, 8, 10].map(n => ({ value: n, label: t('{0} workouts', n) }))} />}+ options={[3, 4, 5, 6, 8, 10].map(n => ({ value: n, label: tn('{0} workout', '{0} workouts', n) }))} />}</Section></>}diff --git a/frontend/src/views/History.jsx b/frontend/src/views/History.jsxindex eaa89b160..751018d96 100644--- a/frontend/src/views/History.jsx+++ b/frontend/src/views/History.jsx@@ -1,6 +1,6 @@import { useNavigate } from 'react-router-dom'import { useStore } from '../store/useStore.js'-import { t } from '../lib/i18n.js'+import { t, tn } from '../lib/i18n.js'import { WorkoutRow, workoutDetailSheet, logPastWorkoutSheet } from '../sheets.jsx'import { Button } from '../components/ui.jsx'import Icon from '../components/Icon.jsx'@@ -10,7 +10,7 @@ export default function History() {const S = useStore(s => s.S)return <><div className="hdr"><button className="iconbtn" onClick={() => nav('/stats')} aria-label={t('Stats')}><Icon name="chevronLeft" /></button>- <div style={{ flex: 1, marginInlineStart: 12 }}><h1>{t('History')}</h1><div className="sub">{t('{0} workouts', S.workouts.length)}</div></div></div>+ <div style={{ flex: 1, marginInlineStart: 12 }}><h1>{t('History')}</h1><div className="sub">{tn('{0} workout', '{0} workouts', S.workouts.length)}</div></div></div><Button icon="plus" onClick={logPastWorkoutSheet} style={{ marginBottom: 12 }}>{t('Log a past workout')}</Button>{S.workouts.length ? <div className="list">{[...S.workouts].reverse().map(w => <WorkoutRow key={w.id} w={w} onClick={() => workoutDetailSheet(w)} />)}</div>: <div className="empty"><div className="ico"><Icon name="history" /></div>{t('No workouts yet.')}</div>}diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsxindex 2e16b77fd..479600b56 100644--- a/frontend/src/views/Home.jsx+++ b/frontend/src/views/Home.jsx@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'import { useStore } from '../store/useStore.js'import { effectiveRoutines, effectiveRoutineIds, nextTrainingDay, streakWeeks, lastBW, setsDoneActive } from '../lib/history.js'import { fmtNum, fmtDate, todayISO, isoOf, weekKey, weekStartOf, weekDayOffset, DAYS, DAYN } from '../lib/format.js'-import { t, dateLocale } from '../lib/i18n.js'+import { t, tn, dateLocale } from '../lib/i18n.js'import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, starterPlanSheet, bwDeltaColor, weighInsSheet } from '../sheets.jsx'import LineChart from '../components/LineChart.jsx'import Icon from '../components/Icon.jsx'@@ -185,7 +185,7 @@ export default function Home() {<Icon name="flame" style={{ color: 'var(--orange)' }} />{t('{0} week streak', streakWeeks(S))}</div>- <div className="muted small" style={{ marginTop: 2 }}>{wThisWeek}{plannedPerWeek ? ' / ' + plannedPerWeek : ''} {t('this week')} · {t(S.workouts.length === 1 ? '{0} workout total' : '{0} workouts total', S.workouts.length)}</div>+ <div className="muted small" style={{ marginTop: 2 }}>{wThisWeek}{plannedPerWeek ? ' / ' + plannedPerWeek : ''} {t('this week')} · {tn('{0} workout total', '{0} workouts total', S.workouts.length)}</div></div><Icon name="calendar" className="chev" style={{ fontSize: 20 }} /></div>diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex d04cc7246..92c78bd73 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -12,7 +12,7 @@ import { unlock, playOnSilentSupported, vibrateSupported } from '../lib/sound.jsimport { api, webauthnOK, passkeyRegister, IS_ANDROID } from '../lib/api.js'import { pushSupported, enablePush, disablePush, sendTestPush, syncPushSubscription } from '../lib/push.js'import { wakeLockSupported } from '../lib/wakelock.js'-import { t, LANGS, INSTR_LANGS, EXERCISE_NAME_LANGS, baseLang } from '../lib/i18n.js'+import { t, tn, LANGS, INSTR_LANGS, EXERCISE_NAME_LANGS, baseLang } from '../lib/i18n.js'import { effectiveLang } from '../lib/default-lang.js'import { DEMO, REPO } from '../lib/demo.js'import { MOBILE, isAndroid, shareExport, shareExportBlob, syncReminder } from '../lib/mobile.js'@@ -166,7 +166,7 @@ export default function Settings() {try { out = await exportBackupZip(st.S, { fetchOne: signedIn ? fetchToStore : null }) }catch { toast(t('Something went wrong')); return }const name = 'opengym-backup-' + todayISO() + '.zip'- if (out.missing) toast(t(out.missing === 1 ? '{0} file could not be included' : '{0} files could not be included', out.missing))+ if (out.missing) toast(tn('{0} file could not be included', '{0} files could not be included', out.missing))if (MOBILE) {try { await shareExportBlob(out.blob, name); if (!out.missing) toast(t('Backup exported')) } catch (e) { /* share sheet dismissed */ }return