Skip to content

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.

Connection line: a server that cannot be reached while the device is online reads Your server cannot be reached instead of Offline … when you are back online, so a proxy's 502 on a phone with a network is no longer blamed on the phone; the words follow the network as it goes and comes

Duarte Santosb69c03ec14ef
diff --git a/frontend/src/components/ServerSync.jsx b/frontend/src/components/ServerSync.jsx
index 179cf2453..44f3ca4c3 100644
--- a/frontend/src/components/ServerSync.jsx
+++ b/frontend/src/components/ServerSync.jsx
@@ -28,14 +28,32 @@ export const hostOf = base => {
try { const u = new URL(base); return u.host + u.pathname.replace(/\/$/, '') } catch { return base || '' }
}
+// Whether the device says it has a network at all. fetch fails the same way for a phone with no
+// network and for a server that is down, or behind a proxy whose error page carries no CORS
+// header (the phone app is another origin): only this tells "offline" from "your server".
+export const isOnline = () => typeof navigator === 'undefined' || navigator.onLine !== false
+// The same, for a screen that has to change its words when the network comes or goes.
+export function useOnline() {
+ const [online, setOnline] = useState(isOnline)
+ useEffect(() => {
+ const on = () => setOnline(isOnline())
+ window.addEventListener('online', on)
+ window.addEventListener('offline', on)
+ return () => { window.removeEventListener('online', on); window.removeEventListener('offline', on) }
+ }, [])
+ return online
+}
+
/* One state of `sync`, in words:
tone 'ok' | 'wait' | 'off' | 'bad' | 'quiet' — the colour, from fine to deliberate local use
line the short status line: Settings, and the toast after "Sync now"
banner the sentence the persistent indicator shows, or null when there is nothing to say
action what the indicator offers: 'retry' | 'pair' | 'signin' | 'connect' | null
- `mobile` is the build (a phone pairs, a browser signs in). Every state that is not 'ok' says the
- changes are kept on this device — that is the one thing the person needs to hear first. */
-export function connectionView(sync, { mobile = MOBILE } = {}) {
+ `mobile` is the build (a phone pairs, a browser signs in); `online` whether the device has a
+ network, which decides whether "offline" is the device or the server. Every state that is not
+ 'ok' says the changes are kept on this device — that is the one thing the person needs to hear
+ first. */
+export function connectionView(sync, { mobile = MOBILE, online = isOnline() } = {}) {
if (!sync) return null
const err = sync.lastError || {}
switch (sync.status) {
@@ -44,6 +62,11 @@ export function connectionView(sync, { mobile = MOBILE } = {}) {
case 'pending': // the sentence already says "tap to retry": no second word for it
return { tone: 'wait', icon: 'reset', line: t('Waiting to sync'), banner: t('Not synced yet — tap to retry.'), action: 'retry', label: null }
case 'offline':
+ if (online) return {
+ tone: 'off', icon: 'cloudSlash', action: 'retry',
+ line: err.code === 'timeout' ? t('The server did not answer in time.') : t('The server cannot be reached'),
+ banner: sync.pending ? t('Your server cannot be reached — your changes are saved on this device and sync once it answers again.') : t('Your server cannot be reached — showing the last copy synced with it.'),
+ }
return {
tone: 'off', icon: 'cloudSlash', action: 'retry',
line: err.code === 'timeout' ? t('The server did not answer in time.') : t('Offline — the server cannot be reached'),
@@ -194,12 +217,13 @@ export function ServerSyncSection({ children }) {
useStore(s => s.S) // the count of waiting changes follows every edit
useStore(s => s.config) // whether "Sign in" may offer a password
const unsynced = useStore(s => s.unsyncedChanges)
+ const online = useOnline()
const [busy, setBusy] = useState(false)
// "Last synced: 3 minutes ago" goes stale on an open screen; a re-render now and then keeps it true.
const [, tick] = useState(0)
useEffect(() => { const iv = setInterval(() => tick(n => n + 1), 30000); return () => clearInterval(iv) }, [])
if (!user || !sync) return null
- const view = connectionView(sync)
+ const view = connectionView(sync, { online })
// While everything is fine, a change still in its short debounce is not news; once anything
// is wrong, how much is waiting is exactly what the person needs.
const owed = sync.status !== 'ok' && typeof unsynced === 'function' ? unsynced() : { owed: false }
diff --git a/frontend/src/components/SyncBanner.jsx b/frontend/src/components/SyncBanner.jsx
index d2cdd982e..24026d434 100644
--- a/frontend/src/components/SyncBanner.jsx
+++ b/frontend/src/components/SyncBanner.jsx
@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
import { DEMO } from '../lib/demo.js'
-import { connectionView, actionLabel, syncNowWithToast, pairAgain, connectServer, signInAgain } from './ServerSync.jsx'
+import { connectionView, actionLabel, syncNowWithToast, pairAgain, connectServer, signInAgain, useOnline } from './ServerSync.jsx'
import Icon from './Icon.jsx'
// How long a change may sit unsent while the server is reachable before it is worth a word: the
@@ -27,6 +27,7 @@ export default function SyncBanner() {
const sync = useStore(s => s.sync)
const guest = useStore(s => s.isGuest())
const onboarding = useStore(s => s.needsMobileOnboarding)
+ const online = useOnline()
const [waited, setWaited] = useState(false)
const row = useRef(null)
const status = sync?.status
@@ -37,7 +38,7 @@ export default function SyncBanner() {
return () => clearTimeout(tm)
}, [status])
- const view = connectionView(sync)
+ const view = connectionView(sync, { online })
// Signed out on the web, the sign-in screen is the whole app: it hears only that the server
// ended the session, and that the changes are still here.
const show = !DEMO && !onboarding && !!view?.banner && (!!user || guest || status === 'auth') && (status !== 'pending' || waited)
diff --git a/frontend/src/components/SyncBanner.test.jsx b/frontend/src/components/SyncBanner.test.jsx
index bda0d0a5e..869473ee3 100644
--- a/frontend/src/components/SyncBanner.test.jsx
+++ b/frontend/src/components/SyncBanner.test.jsx
@@ -46,8 +46,15 @@ vi.mock('../views/MobileOnboarding.jsx', () => ({ ConnectSheet: props => <div cl
const BASE = 'https://gym.example.com'
const sync = (status, extra = {}) => ({ status, offline: false, pending: false, auth: false, lastError: null, lastSynced: 0, server: BASE, ...extra })
+// Whether the device has a network (navigator.onLine), and the event that says it changed.
+const network = on => {
+ Object.defineProperty(navigator, 'onLine', { configurable: true, get: () => on })
+ window.dispatchEvent(new Event(on ? 'online' : 'offline'))
+}
+
let host, root
beforeEach(() => {
+ network(true)
Object.assign(mocks, { MOBILE: false, DEMO: false, webauthn: true, user: { id: 'u1', name: 'andi' }, guest: false, onboarding: false, sync: sync('ok') })
mocks.sheets.length = 0
mocks.navs.length = 0
@@ -80,6 +87,7 @@ describe('connected and in step', () => {
describe('not connected — it says so, and what to do', () => {
it('offline with changes waiting: kept on this device, and a retry that reports back', async () => {
+ network(false)
mocks.sync = sync('offline', { offline: true, pending: true, lastError: { status: 0, code: 'network' } })
render()
expect(text()).toBe('Offline — your changes are saved on this device and sync when you are back online.')
@@ -93,11 +101,34 @@ describe('not connected — it says so, and what to do', () => {
})
it('offline with nothing waiting: the copy on screen is the last synced one', () => {
+ network(false)
mocks.sync = sync('offline', { offline: true, lastError: { status: 0, code: 'timeout' } })
render()
expect(text()).toBe('Offline — showing the last copy synced with the server.')
})
+ // A proxy answering 502 without a CORS header fails fetch exactly as no network does; the phone
+ // was online and still read "Offline … sync when you are back online" (Android QA, v1.3.9).
+ it('the server out of reach while the device is online is the server, not the device', async () => {
+ mocks.sync = sync('offline', { offline: true, pending: true, lastError: { status: 0, code: 'network' } })
+ render()
+ expect(text()).toBe('Your server cannot be reached — your changes are saved on this device and sync once it answers again.')
+ expect(bar().className).toContain('off')
+ expect(label()).toBe('Try again')
+ await act(async () => { button().click() })
+ expect(mocks.toast).toHaveBeenCalledWith('The server cannot be reached')
+ })
+
+ it('with nothing waiting it shows the last copy, and the words follow the network as it goes and comes', () => {
+ mocks.sync = sync('offline', { offline: true, lastError: { status: 0, code: 'network' } })
+ render()
+ expect(text()).toBe('Your server cannot be reached — showing the last copy synced with it.')
+ act(() => network(false))
+ expect(text()).toBe('Offline — showing the last copy synced with the server.')
+ act(() => network(true))
+ expect(text()).toBe('Your server cannot be reached — showing the last copy synced with it.')
+ })
+
it('a server error carries its HTTP code, for whoever runs the server', () => {
mocks.sync = sync('error', { pending: true, lastError: { status: 502, code: 'http' } })
render()
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index dac9b3762..ab6994aa7 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1597,4 +1597,7 @@ export default {
'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}',
+ 'The server cannot be reached': 'تعذّر الوصول إلى الخادم',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'تعذّر الوصول إلى خادمك — تُحفظ تغييراتك على هذا الجهاز وتتزامن عندما يستجيب مجددًا.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'تعذّر الوصول إلى خادمك — يُعرض آخر نسخة متزامنة معه.',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 4a908b80a..b19a376cb 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1564,4 +1564,7 @@ export default {
'Log your body weight to score this lift.': 'Trag dein Körpergewicht ein, damit diese Übung bewertet werden kann.',
'Log the anchor lift to score this one.': 'Trag die Anker-Übung ein, damit diese bewertet werden kann.',
'Not scored': 'Nicht bewertet',
+ 'The server cannot be reached': 'Der Server ist nicht erreichbar',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Dein Server ist nicht erreichbar — deine Änderungen sind auf diesem Gerät gespeichert und werden synchronisiert, sobald er wieder antwortet.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Dein Server ist nicht erreichbar — zeigt die zuletzt mit ihm synchronisierte Kopie.',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 1950c5525..5c467db17 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'Registra tu peso corporal para evaluar este ejercicio.',
'Log the anchor lift to score this one.': 'Registra el ejercicio ancla para evaluar este.',
'Not scored': 'Sin evaluar',
+ 'The server cannot be reached': 'No se puede llegar al servidor',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'No se puede llegar a tu servidor: tus cambios se guardan en este dispositivo y se sincronizarán cuando vuelva a responder.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'No se puede llegar a tu servidor: se muestra la última copia sincronizada con él.',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 378e8580d..407b4f42b 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'Note ton poids corporel pour évaluer cet exercice.',
'Log the anchor lift to score this one.': 'Note l’exercice de référence pour évaluer celui-ci.',
'Not scored': 'Non évalué',
+ 'The server cannot be reached': 'Le serveur est injoignable',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Votre serveur est injoignable — vos modifications sont enregistrées sur cet appareil et seront synchronisées dès qu\'il répondra à nouveau.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Votre serveur est injoignable — affichage de la dernière copie synchronisée avec lui.',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index b5da08470..0fc1d9abd 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'इस व्यायाम का आकलन करने के लिए अपने शरीर का वज़न दर्ज करें।',
'Log the anchor lift to score this one.': 'इसका आकलन करने के लिए आधार व्यायाम दर्ज करें।',
'Not scored': 'आकलन नहीं हुआ',
+ 'The server cannot be reached': 'सर्वर तक नहीं पहुँचा जा सकता',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'आपके सर्वर तक नहीं पहुँचा जा सकता — आपके बदलाव इस डिवाइस पर सहेजे गए हैं और उसके फिर से जवाब देते ही सिंक हो जाएँगे।',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'आपके सर्वर तक नहीं पहुँचा जा सकता — उससे सिंक की गई आख़िरी प्रति दिखाई जा रही है।',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 73f877747..1fd2096a9 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1547,4 +1547,7 @@ export default {
'Log your body weight to score this lift.': 'Rögzítsd a testsúlyodat, hogy ez a gyakorlat értékelhető legyen.',
'Log the anchor lift to score this one.': 'Rögzítsd a viszonyítási alapul szolgáló gyakorlatot, hogy ez is értékelhető legyen.',
'Not scored': 'Nincs értékelve',
+ 'The server cannot be reached': 'A szerver nem érhető el',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'A szervered nem érhető el — a módosításaid ezen az eszközön vannak mentve, és szinkronizálódnak, amint újra válaszol.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'A szervered nem érhető el — a vele utoljára szinkronizált másolat látható.',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index a5c176744..40a870092 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'Registra il tuo peso corporeo per valutare questo esercizio.',
'Log the anchor lift to score this one.': 'Registra l’esercizio di riferimento per valutare questo.',
'Not scored': 'Non valutato',
+ 'The server cannot be reached': 'Il server non è raggiungibile',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Il tuo server non è raggiungibile — le tue modifiche sono salvate su questo dispositivo e verranno sincronizzate quando risponderà di nuovo.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Il tuo server non è raggiungibile — viene mostrata l’ultima copia sincronizzata con esso.',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 52c622640..4d538a56f 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': '이 운동을 평가하려면 체중을 기록하세요.',
'Log the anchor lift to score this one.': '이 운동을 평가하려면 기준 운동을 기록하세요.',
'Not scored': '평가 안 됨',
+ 'The server cannot be reached': '서버에 연결할 수 없음',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': '서버에 연결할 수 없습니다 — 변경 사항은 이 기기에 저장되며 서버가 다시 응답하면 동기화됩니다.',
+ 'Your server cannot be reached — showing the last copy synced with it.': '서버에 연결할 수 없습니다 — 서버와 마지막으로 동기화된 사본을 표시합니다.',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index e32cdcb6d..12ab4f662 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'Zapisz swoją masę ciała, aby ocenić to ćwiczenie.',
'Log the anchor lift to score this one.': 'Zapisz ćwiczenie będące punktem odniesienia, aby ocenić to ćwiczenie.',
'Not scored': 'Bez oceny',
+ 'The server cannot be reached': 'Serwer jest nieosiągalny',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Twój serwer jest nieosiągalny — zmiany są zapisane na tym urządzeniu i zsynchronizują się, gdy znów odpowie.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Twój serwer jest nieosiągalny — wyświetlana jest ostatnia kopia z nim zsynchronizowana.',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 87ff1a4b3..04fac75d3 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -903,6 +903,9 @@ export const PT_BR_OVERRIDES = {
'Custom': 'Personalizado',
'Log your body weight to score this lift.': 'Registre seu peso corporal para avaliar este exercício.',
'Log the anchor lift to score this one.': 'Registre o exercício de referência para avaliar este.',
+ 'The server cannot be reached': 'Não é possível acessar o servidor',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Não é possível acessar o seu servidor — suas alterações ficam salvas neste dispositivo e sincronizam assim que ele voltar a responder.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Não é possível acessar o seu servidor — mostrando a última cópia sincronizada com ele.',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index a24c3d453..c2702a75b 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'Regista o teu peso corporal para avaliar este exercício.',
'Log the anchor lift to score this one.': 'Regista o exercício de referência para avaliar este.',
'Not scored': 'Sem avaliação',
+ 'The server cannot be reached': 'Não é possível chegar ao servidor',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Não é possível chegar ao teu servidor — as tuas alterações ficam guardadas neste dispositivo e sincronizam assim que ele voltar a responder.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Não é possível chegar ao teu servidor — a mostrar a última cópia sincronizada com ele.',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 8509c6f6c..b0ba9019b 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'Запишите вес тела, чтобы оценить это упражнение.',
'Log the anchor lift to score this one.': 'Запишите опорное упражнение, чтобы оценить это.',
'Not scored': 'Не оценено',
+ 'The server cannot be reached': 'Сервер недоступен',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Ваш сервер недоступен — изменения сохранены на этом устройстве и синхронизируются, как только он снова ответит.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Ваш сервер недоступен — показана последняя копия, синхронизированная с ним.',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 113bc6195..ea0cd7f54 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1555,4 +1555,7 @@ export default {
'Log your body weight to score this lift.': 'บันทึกน้ำหนักตัวเพื่อประเมินท่านี้',
'Log the anchor lift to score this one.': 'บันทึกท่าอ้างอิงเพื่อประเมินท่านี้',
'Not scored': 'ยังไม่ได้ประเมิน',
+ 'The server cannot be reached': 'เชื่อมต่อเซิร์ฟเวอร์ไม่ได้',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'เชื่อมต่อเซิร์ฟเวอร์ของคุณไม่ได้ — การเปลี่ยนแปลงถูกบันทึกไว้ในอุปกรณ์นี้และจะซิงค์เมื่อเซิร์ฟเวอร์ตอบกลับอีกครั้ง',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'เชื่อมต่อเซิร์ฟเวอร์ของคุณไม่ได้ — แสดงสำเนาล่าสุดที่ซิงค์กับเซิร์ฟเวอร์',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 3551af1cb..a09e283e3 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': 'Bu hareketin değerlendirilmesi için vücut ağırlığını kaydet.',
'Log the anchor lift to score this one.': 'Bunu değerlendirmek için referans hareketi kaydet.',
'Not scored': 'Değerlendirilmedi',
+ 'The server cannot be reached': 'Sunucuya ulaşılamıyor',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Sunucuna ulaşılamıyor — değişikliklerin bu cihazda kayıtlı, sunucu yeniden yanıt verince eşitlenecek.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Sunucuna ulaşılamıyor — sunucuyla en son eşitlenen kopya gösteriliyor.',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 2b7ae36d2..91a1de071 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1541,4 +1541,7 @@ export default {
'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}',
+ 'The server cannot be reached': 'Сервер недоступний',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': 'Твій сервер недоступний — зміни збережено на цьому пристрої, вони синхронізуються, щойно він знову відповість.',
+ 'Your server cannot be reached — showing the last copy synced with it.': 'Твій сервер недоступний — показано останню копію, синхронізовану з ним.',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index e3e097d6d..daa4797ed 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1544,4 +1544,7 @@ export default {
'Log your body weight to score this lift.': '记录你的体重以评估这个动作。',
'Log the anchor lift to score this one.': '记录锚点动作以评估这个动作。',
'Not scored': '未评估',
+ 'The server cannot be reached': '无法连接服务器',
+ 'Your server cannot be reached — your changes are saved on this device and sync once it answers again.': '无法连接你的服务器 — 你的更改已保存在此设备上,服务器恢复响应后会自动同步。',
+ 'Your server cannot be reached — showing the last copy synced with it.': '无法连接你的服务器 — 正在显示最后一次与它同步的副本。',
}
diff --git a/frontend/src/views/Settings.server-sync.test.jsx b/frontend/src/views/Settings.server-sync.test.jsx
index c32a35784..98068e152 100644
--- a/frontend/src/views/Settings.server-sync.test.jsx
+++ b/frontend/src/views/Settings.server-sync.test.jsx
@@ -213,7 +213,7 @@ describe('leaving the server', () => {
await act(async () => { buttonByText(sheet, 'Try again').click() })
expect(mocks.syncNow).toHaveBeenCalledTimes(1)
expect(mocks.navs).toEqual([])
- expect(sheet.textContent).toContain('Offline — the server cannot be reached') // why it is still waiting
+ expect(sheet.textContent).toContain('The server cannot be reached') // why it is still waiting (the device itself is online)
mocks.disconnectServer.mockResolvedValueOnce({ owed: false })
await act(async () => { buttonByText(sheet, 'Try again').click() })