diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index f0a1176..7104495 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -5,8 +5,10 @@ import { useInstallPrompt } from './hooks/useInstallPrompt' import { usePoll } from './hooks/usePoll' import { api } from './lib/api' import { ago } from './lib/format' +import { useT } from './lib/i18n' import Dashboard from './pages/Dashboard' import InverterDetail from './pages/InverterDetail' +import Settings from './pages/Settings' function useTick(ms) { const [, setN] = useState(0) @@ -17,6 +19,7 @@ function useTick(ms) { } function LiveChip({ summary, error }) { + const { t } = useT() useTick(10_000) if (error && !summary) return null if (!summary) return null @@ -28,7 +31,11 @@ function LiveChip({ summary, error }) { style={{ background: ok ? 'var(--good)' : 'var(--critical)' }} aria-hidden="true" /> - {error ? 'Connection lost' : ok ? `Live · ${ago(summary.datalogger.last_ingest_at)}` : 'Datalogger offline'} + {error + ? t('live.connectionLost') + : ok + ? t('live.live', { ago: ago(summary.datalogger.last_ingest_at) }) + : t('live.dataloggerOffline')} ) } @@ -37,26 +44,38 @@ export default function App() { // One summary poll shared by both pages, so navigating is instant const summaryPoll = usePoll(() => api.summary(), 30_000) const install = useInstallPrompt() + const { t, lang, setLang } = useT() + const iconButton = + 'inline-flex min-h-9 min-w-9 items-center justify-center gap-1 rounded-lg border border-line px-2 text-xs font-medium text-ink-2 hover:text-ink' return (
/api/readings.
- API documentation + {t('dash.apiDocs')}
- {latest ? `Last reading ${new Date(latest.timestamp).toLocaleString()}` : 'No readings yet'} - {latest && !live && ' — values are from the last time it reported'} + {latest ? t('detail.lastReadingAt', { when: dateTime(latest.timestamp) }) : t('detail.noReadings')} + {latest && !live && t('detail.stale')}
Not available yet
} +{t('detail.notSent')}
}- {hasDc - ? 'MPPT1 and MPPT2 should track each other when both carry similar strings — one dropping away from the other points at that string.' - : 'DC input (MPPT) values are not available yet.'} + {hasDc ? t('detail.mpptNote') : t('detail.noDc')}
{help}
} + {children} +