Colota - Android GPS Location tracker
refactor(i18n): move the Dashboard into the catalog (#909)
Max Dietrich6dd2682151a7
diff --git a/apps/mobile/src/components/features/dashboard/ConnectionStatus.tsx b/apps/mobile/src/components/features/dashboard/ConnectionStatus.tsxindex e6fc08ba..2f2b5ab8 100644--- a/apps/mobile/src/components/features/dashboard/ConnectionStatus.tsx+++ b/apps/mobile/src/components/features/dashboard/ConnectionStatus.tsx@@ -16,9 +16,11 @@ import { size, space, STATE_LAYER_ALPHA } from "../../../constants"import { describeServer, endpointHost, type ServerTone } from "../../../utils/serverState"import { formatCount } from "../../../utils/format"import { radius } from "@colota/shared"+import { useTranslation } from "../../../i18n/useTranslation"export function ConnectionStatus({ endpoint, navigation }: ConnectionStatusProps) {const { colors } = useTheme()+ const { t } = useTranslation()const { settings } = useTracking()const isOffline = settings.isOfflineMode@@ -56,14 +58,14 @@ export function ConnectionStatus({ endpoint, navigation }: ConnectionStatusProps}, [endpoint, isOffline]))- const tone = (t: ServerTone) =>- t === "success"+ const tone = (value: ServerTone) =>+ value === "success"? colors.success- : t === "error"+ : value === "error"? colors.error- : t === "warning"+ : value === "warning"? colors.warning- : t === "light"+ : value === "light"? colors.textLight: colors.textSecondary@@ -77,12 +79,12 @@ export function ConnectionStatus({ endpoint, navigation }: ConnectionStatusPropslastSyncTime: stats?.lastSyncTime ?? 0,lastSyncError: stats?.lastSyncError ?? ""})- const word = known ? server.word : "Checking"+ const word = known ? server.word : t("dashboard.checking")const dotColor = known ? tone(server.tone) : colors.textLight- const hostLabel = isOffline ? "Offline mode" : endpoint ? endpointHost(endpoint) : "Server"+ const hostLabel = isOffline ? t("dashboard.offlineMode") : endpoint ? endpointHost(endpoint) : t("dashboard.server")const queued = stats?.queued ?? 0- const queueLabel = queued > 0 ? `${formatCount(queued)} queued` : ""+ const queueLabel = queued > 0 ? t("server.queued", { count: queued, n: formatCount(queued) }) : ""const spokenStatus = [word, queueLabel].filter(Boolean).join(" · ")// A healthy server says nothing; the word is for a screen reader, which cannot see the dot.const statusLabel = known && server.tone === "success" ? queueLabel : spokenStatusdiff --git a/apps/mobile/src/components/features/dashboard/DashboardBanner.tsx b/apps/mobile/src/components/features/dashboard/DashboardBanner.tsxindex f7314edf..98111306 100644--- a/apps/mobile/src/components/features/dashboard/DashboardBanner.tsx+++ b/apps/mobile/src/components/features/dashboard/DashboardBanner.tsx@@ -11,6 +11,8 @@ import { useTheme } from "../../../hooks/useTheme"import { fontSizes, fonts, lineHeights } from "../../../styles/typography"import { elevation, size, space } from "../../../constants"import { Button } from "../../ui/Button"+import { useTranslation } from "../../../i18n/useTranslation"+import type { TranslationKey } from "../../../i18n/options"export type BannerCondition = "permission" | "background" | "locationOff" | "battery"@@ -25,17 +27,18 @@ type Props = {const CONTENT: Record<BannerCondition,- { icon: LucideIcon; tone: "error" | "warning"; text: string; action: string | null }+ { icon: LucideIcon; tone: "error" | "warning"; textKey: TranslationKey; actionKey: TranslationKey | null }> = {- permission: { icon: CircleAlert, tone: "error", text: "Location permission missing", action: "Grant" },- background: { icon: CircleAlert, tone: "error", text: "Background location not allowed", action: "Grant" },- locationOff: { icon: TriangleAlert, tone: "warning", text: "Location services are off", action: "Settings" },- battery: { icon: BatteryWarning, tone: "error", text: "Battery critically low. Charge to track.", action: null }+ permission: { icon: CircleAlert, tone: "error", textKey: "banner.permission", actionKey: "banner.grant" },+ background: { icon: CircleAlert, tone: "error", textKey: "banner.background", actionKey: "banner.grant" },+ locationOff: { icon: TriangleAlert, tone: "warning", textKey: "banner.locationOff", actionKey: "banner.settings" },+ battery: { icon: BatteryWarning, tone: "error", textKey: "banner.battery", actionKey: null }}export function DashboardBanner({ condition, onAction, top, left, right, onLayout }: Props) {const { colors } = useTheme()- const { icon: Icon, tone, text, action } = CONTENT[condition]+ const { t } = useTranslation()+ const { icon: Icon, tone, textKey, actionKey } = CONTENT[condition]return (<View@@ -46,9 +49,9 @@ export function DashboardBanner({ condition, onAction, top, left, right, onLayoutestID="dashboard-banner"><Icon size={size.icon.md} color={colors[tone]} />- <Text style={[styles.text, { color: colors.text }]}>{text}</Text>- {action !== null && (- <Button title={action} variant="ghost" shape="rounded" color={colors.primary} onPress={onAction} />+ <Text style={[styles.text, { color: colors.text }]}>{t(textKey)}</Text>+ {actionKey !== null && (+ <Button title={t(actionKey)} variant="ghost" shape="rounded" color={colors.primary} onPress={onAction} />)}</View>)diff --git a/apps/mobile/src/components/features/dashboard/DashboardDock.tsx b/apps/mobile/src/components/features/dashboard/DashboardDock.tsxindex f891f14a..40524dc7 100644--- a/apps/mobile/src/components/features/dashboard/DashboardDock.tsx+++ b/apps/mobile/src/components/features/dashboard/DashboardDock.tsx@@ -17,6 +17,7 @@ import { StatRow } from "../../ui/StatRow"import { ConnectionStatus } from "./ConnectionStatus"import { StateLine } from "../../ui/StateLine"import { WelcomeCard } from "./WelcomeCard"+import { useTranslation } from "../../../i18n/useTranslation"type DashboardDockProps = {tracking: boolean@@ -75,6 +76,7 @@ export function DashboardDock({onNavigateToRequestFormat}: DashboardDockProps) {const { colors } = useTheme()+ const { t } = useTranslation()if (firstRun) {return (@@ -117,7 +119,7 @@ export function DashboardDock({<MapDock maxHeight={maxHeight}><StateLine icon={icon} iconColor={iconColor} label={state.label} caption={state.caption} testID="dock-state" /><Divider tight inset />- <StatRow icon={Timer} label="Interval" value={intervalText} testID="dock-interval" />+ <StatRow icon={Timer} label={t("dashboard.interval")} value={intervalText} testID="dock-interval" />{!isOfflineMode && (<><Divider tight inset />diff --git a/apps/mobile/src/components/features/dashboard/WelcomeCard.tsx b/apps/mobile/src/components/features/dashboard/WelcomeCard.tsxindex ad4e7487..cc9238a6 100644--- a/apps/mobile/src/components/features/dashboard/WelcomeCard.tsx+++ b/apps/mobile/src/components/features/dashboard/WelcomeCard.tsx@@ -13,6 +13,8 @@ import { Button } from "../../ui/Button"import { Card } from "../../ui/Card"import { size, space, STATE_LAYER_ALPHA } from "../../../constants"import { radius } from "@colota/shared"+import { t } from "../../../i18n/t"+import { useTranslation } from "../../../i18n/useTranslation"interface WelcomeCardProps {settings: Settings@@ -76,6 +78,7 @@ export function WelcomeCard({onNavigateToTrackingSync,onNavigateToRequestFormat}: WelcomeCardProps) {+ useTranslation()const {settings: { isOfflineMode }} = useTracking()@@ -83,14 +86,14 @@ export function WelcomeCard({return (<Card variant="elevated">- <Text style={[styles.title, { color: colors.text }]}>Welcome to Colota</Text>- <Text style={[styles.subtitle, { color: colors.textSecondary }]}>Get started by completing these steps:</Text>+ <Text style={[styles.title, { color: colors.text }]}>{t("welcome.title")}</Text>+ <Text style={[styles.subtitle, { color: colors.textSecondary }]}>{t("welcome.subtitle")}</Text><View style={styles.checklist}>- <ChecklistItem label="1. Start tracking" completed={tracking} colors={colors} onPress={onStartTracking} />+ <ChecklistItem label={t("welcome.step1")} completed={tracking} colors={colors} onPress={onStartTracking} />{!isOfflineMode && (<ChecklistItem- label="2. Configure your server endpoint"+ label={t("welcome.step2")}completed={hasEndpoint}colors={colors}onPress={onNavigateToConnection}@@ -106,7 +109,7 @@ export function WelcomeCard({android_ripple={{ color: colors.text + STATE_LAYER_ALPHA }}style={styles.linkTarget}>- <Text style={[styles.link, { color: colors.link }]}>Request format</Text>+ <Text style={[styles.link, { color: colors.link }]}>{t("welcome.requestFormat")}</Text></Pressable>)}<Pressable@@ -115,11 +118,11 @@ export function WelcomeCard({android_ripple={{ color: colors.text + STATE_LAYER_ALPHA }}style={styles.linkTarget}>- <Text style={[styles.link, { color: colors.link }]}>Tracking presets</Text>+ <Text style={[styles.link, { color: colors.link }]}>{t("welcome.presets")}</Text></Pressable></View>- <Button title="Got it" variant="secondary" onPress={onDismiss} />+ <Button title={t("welcome.dismiss")} variant="secondary" onPress={onDismiss} /></Card>)}diff --git a/apps/mobile/src/components/ui/DisclosureModal.tsx b/apps/mobile/src/components/ui/DisclosureModal.tsxindex a170fcbe..be4f8451 100644--- a/apps/mobile/src/components/ui/DisclosureModal.tsx+++ b/apps/mobile/src/components/ui/DisclosureModal.tsx@@ -9,6 +9,7 @@ import { useTheme } from "../../hooks/useTheme"import { fontSizes, fonts, lineHeights, type } from "../../styles/typography"import { radius } from "@colota/shared"import { size, space, STATE_LAYER_ALPHA, elevation } from "../../constants"+import { useTranslation } from "../../i18n/useTranslation"interface DisclosureModalProps {icon: React.ReactNode@@ -27,6 +28,7 @@ interface DisclosureModalProps {*/export function DisclosureModal({ icon, title, paragraphs, confirmLabel, registerCallback }: DisclosureModalProps) {const { colors } = useTheme()+ const { t } = useTranslation()const [visible, setVisible] = useState(false)const resolveRef = useRef<((value: boolean) => void) | null>(null)@@ -83,7 +85,7 @@ export function DisclosureModal({ icon, title, paragraphs, confirmLabel, registestyle={styles.button}onPress={handleNotNow}>- <Text style={[styles.buttonText, { color: colors.textSecondary }]}>Not now</Text>+ <Text style={[styles.buttonText, { color: colors.textSecondary }]}>{t("disclosure.notNow")}</Text></Pressable><Pressablediff --git a/apps/mobile/src/components/ui/LocalNetworkDisclosureModal.tsx b/apps/mobile/src/components/ui/LocalNetworkDisclosureModal.tsxindex d58b6a35..0fd782b4 100644--- a/apps/mobile/src/components/ui/LocalNetworkDisclosureModal.tsx+++ b/apps/mobile/src/components/ui/LocalNetworkDisclosureModal.tsx@@ -9,6 +9,7 @@ import { size } from "../../constants"import { useTheme } from "../../hooks/useTheme"import { registerLocalNetworkDisclosureCallback } from "../../services/LocationServicePermission"import { DisclosureModal } from "./DisclosureModal"+import { useTranslation } from "../../i18n/useTranslation"/*** Disclosure modal for the local network permission.@@ -16,16 +17,14 @@ import { DisclosureModal } from "./DisclosureModal"*/export function LocalNetworkDisclosureModal() {const { colors } = useTheme()+ const { t } = useTranslation()return (<DisclosureModalicon={<Wifi size={size.icon.lg} color={colors.primary} />}- title="Local network access"- paragraphs={[- "Your server is on the local network. Colota needs local network access permission to reach it.",- "This permission is only used to connect to your self-hosted server. No device scanning or discovery is performed."- ]}- confirmLabel="Continue"+ title={t("disclosure.network.title")}+ paragraphs={[t("disclosure.network.p1"), t("disclosure.network.p2")]}+ confirmLabel={t("disclosure.network.confirm")}registerCallback={registerLocalNetworkDisclosureCallback}/>)diff --git a/apps/mobile/src/components/ui/LocationDisclosureModal.tsx b/apps/mobile/src/components/ui/LocationDisclosureModal.tsxindex a0d4bd88..626c4f95 100644--- a/apps/mobile/src/components/ui/LocationDisclosureModal.tsx+++ b/apps/mobile/src/components/ui/LocationDisclosureModal.tsx@@ -9,6 +9,7 @@ import { size } from "../../constants"import { useTheme } from "../../hooks/useTheme"import { registerDisclosureCallback } from "../../services/LocationServicePermission"import { DisclosureModal } from "./DisclosureModal"+import { useTranslation } from "../../i18n/useTranslation"/*** Prominent in-app disclosure modal for location data collection.@@ -16,17 +17,14 @@ import { DisclosureModal } from "./DisclosureModal"*/export function LocationDisclosureModal() {const { colors } = useTheme()+ const { t } = useTranslation()return (<DisclosureModalicon={<MapPin size={size.icon.lg} color={colors.primary} />}- title="Location data collection"- paragraphs={[- "Colota collects location data to enable GPS tracking and sending your position to your configured server, even when the app is closed or not in use.",- "This data is sent only to the server you set up. No data is shared with third parties.",- "While tracking runs, a persistent notification shows its status. Battery optimization should be disabled for reliable background operation."- ]}- confirmLabel="Agree"+ title={t("disclosure.location.title")}+ paragraphs={[t("disclosure.location.p1"), t("disclosure.location.p2"), t("disclosure.location.p3")]}+ confirmLabel={t("disclosure.location.confirm")}registerCallback={registerDisclosureCallback}/>)diff --git a/apps/mobile/src/components/ui/__tests__/LocationDisclosureModal.test.tsx b/apps/mobile/src/components/ui/__tests__/LocationDisclosureModal.test.tsxnew file mode 100644index 00000000..108223e7--- /dev/null+++ b/apps/mobile/src/components/ui/__tests__/LocationDisclosureModal.test.tsx@@ -0,0 +1,37 @@+import React from "react"+import { render, act } from "@testing-library/react-native"++let mockShow: () => Promise<boolean> = () => Promise.resolve(false)++jest.mock("../../../hooks/useTheme", () => ({+ useTheme: () => ({ colors: require("@colota/shared").lightColors })+}))++jest.mock("../../../services/LocationServicePermission", () => ({+ registerDisclosureCallback: (cb: () => Promise<boolean>) => {+ mockShow = cb+ }+}))++import { LocationDisclosureModal } from "../LocationDisclosureModal"++describe("LocationDisclosureModal", () => {+ // Google Play reviewed this disclosure; the order and the wording on screen are what it approved.+ it("shows the reviewed title, the three paragraphs in order and Agree", async () => {+ const { getByText, toJSON } = render(<LocationDisclosureModal />)++ await act(async () => {+ mockShow()+ })++ expect(getByText("Location data collection")).toBeTruthy()+ expect(getByText("Agree")).toBeTruthy()+ const text = JSON.stringify(toJSON())+ const first = text.indexOf("Colota collects location data to enable GPS tracking")+ const second = text.indexOf("This data is sent only to the server you set up.")+ const third = text.indexOf("While tracking runs, a persistent notification shows its status.")+ expect(first).toBeGreaterThan(-1)+ expect(second).toBeGreaterThan(first)+ expect(third).toBeGreaterThan(second)+ })+})diff --git a/apps/mobile/src/i18n/__tests__/i18n.test.ts b/apps/mobile/src/i18n/__tests__/i18n.test.tsindex 9f9969e1..17727056 100644--- a/apps/mobile/src/i18n/__tests__/i18n.test.ts+++ b/apps/mobile/src/i18n/__tests__/i18n.test.ts@@ -91,3 +91,15 @@ describe("plurals without Intl.PluralRules", () => {expect(hermesLike.t("settings.offlineMaps.areas", { count: 2, n: "2" })).toBe("2 areas")})})++describe("prominent disclosure wording", () => {+ // Google Play reviewed this text for the background location declaration; an edit has to be deliberate.+ it("keeps the English location disclosure exactly as submitted", () => {+ expect([en["disclosure.location.p1"], en["disclosure.location.p2"], en["disclosure.location.p3"]]).toEqual([+ "Colota collects location data to enable GPS tracking and sending your position to your configured server, even when the app is closed or not in use.",+ "This data is sent only to the server you set up. No data is shared with third parties.",+ "While tracking runs, a persistent notification shows its status. Battery optimization should be disabled for reliable background operation."+ ])+ expect(en["disclosure.location.confirm"]).toBe("Agree")+ })+})diff --git a/apps/mobile/src/i18n/locales/en.json b/apps/mobile/src/i18n/locales/en.jsonindex 2e1e1c82..56b59395 100644--- a/apps/mobile/src/i18n/locales/en.json+++ b/apps/mobile/src/i18n/locales/en.json@@ -649,5 +649,52 @@"summary.weekOf": "Week of {{date}}","summary.thisMonth": "This month","summary.lastMonth": "Last month",- "tripDetail.maxSpeed": "max {{value}}"+ "tripDetail.maxSpeed": "max {{value}}",+ "state.stoppedByBattery": "Battery fell below 5%",+ "state.noFixYet": "No fix yet",+ "state.locationOff": "Location services are off",+ "state.pause.wifi": "{{zone}} WiFi · resumes when you leave",+ "state.pause.motionless": "No movement · resumes when you move",+ "state.pause.zone": "Inside zone · resumes when you leave",+ "state.stopped": "Tracking stopped",+ "state.ready": "Ready",+ "state.pausedIn": "Paused in {{zone}}",+ "state.searching": "Searching for GPS",+ "state.tracking": "Tracking",+ "state.trackingProfile": "Tracking · {{profile}}",+ "state.noFixes": "No fixes yet",+ "state.lastFix": "Last fix {{when}}",+ "disclosure.location.title": "Location data collection",+ "disclosure.location.p1": "Colota collects location data to enable GPS tracking and sending your position to your configured server, even when the app is closed or not in use.",+ "disclosure.location.p2": "This data is sent only to the server you set up. No data is shared with third parties.",+ "disclosure.location.p3": "While tracking runs, a persistent notification shows its status. Battery optimization should be disabled for reliable background operation.",+ "disclosure.location.confirm": "Agree",+ "disclosure.network.title": "Local network access",+ "disclosure.network.p1": "Your server is on the local network. Colota needs local network access permission to reach it.",+ "disclosure.network.p2": "This permission is only used to connect to your self-hosted server. No device scanning or discovery is performed.",+ "disclosure.network.confirm": "Continue",+ "disclosure.notNow": "Not now",+ "banner.permission": "Location permission missing",+ "banner.background": "Background location not allowed",+ "banner.locationOff": "Location services are off",+ "banner.battery": "Battery critically low. Charge to track.",+ "banner.grant": "Grant",+ "banner.settings": "Settings",+ "dashboard.checking": "Checking",+ "dashboard.offlineMode": "Offline mode",+ "dashboard.server": "Server",+ "dashboard.interval": "Interval",+ "welcome.title": "Welcome to Colota",+ "welcome.subtitle": "Get started by completing these steps:",+ "welcome.step1": "1. Start tracking",+ "welcome.step2": "2. Configure your server endpoint",+ "welcome.requestFormat": "Request format",+ "welcome.presets": "Tracking presets",+ "welcome.dismiss": "Got it",+ "dashboard.locationOff.title": "Please enable Location Services",+ "dashboard.locationOff.message": "Location Services are disabled. Tracking will not work until they are enabled in Settings.",+ "dashboard.locationOff.confirm": "Location settings",+ "dashboard.locationOff.cancel": "Start anyway",+ "dashboard.stop": "Stop tracking",+ "dashboard.start": "Start tracking"}diff --git a/apps/mobile/src/screens/DashboardScreen.tsx b/apps/mobile/src/screens/DashboardScreen.tsxindex fdaa6ba5..6b13363e 100644--- a/apps/mobile/src/screens/DashboardScreen.tsx+++ b/apps/mobile/src/screens/DashboardScreen.tsx@@ -21,6 +21,7 @@ import { intervalText, pickBannerCondition } from "../utils/dashboardState"import { size, space } from "../constants"import { Square, Play } from "lucide-react-native"import { logger } from "../utils/logger"+import { useTranslation } from "../i18n/useTranslation"export function DashboardScreen({ navigation }: ScreenProps) {const {@@ -35,6 +36,7 @@ export function DashboardScreen({ navigation }: ScreenProps) {} = useTracking()const coords = useCoords()const { colors, isDark } = useTheme()+ const { t } = useTranslation()const insets = useSafeAreaInsets()const { height: windowHeight } = useWindowDimensions()const isFocused = useIsFocused()@@ -62,10 +64,10 @@ export function DashboardScreen({ navigation }: ScreenProps) {const locationOn = await NativeLocationService.isLocationEnabled()if (!locationOn) {const openSettings = await showConfirm({- title: "Please enable Location Services",- message: "Location Services are disabled. Tracking will not work until they are enabled in Settings.",- confirmText: "Location settings",- cancelText: "Start anyway"+ title: t("dashboard.locationOff.title"),+ message: t("dashboard.locationOff.message"),+ confirmText: t("dashboard.locationOff.confirm"),+ cancelText: t("dashboard.locationOff.cancel")})if (openSettings) {await NativeLocationService.openLocationSettings()@@ -274,7 +276,7 @@ export function DashboardScreen({ navigation }: ScreenProps) {onPress={tracking ? handleStop : handleStart}loading={!settingsHydrated}disabled={!tracking && isBatteryCritical}- title={tracking ? "Stop tracking" : "Start tracking"}+ title={tracking ? t("dashboard.stop") : t("dashboard.start")}/></View>diff --git a/apps/mobile/src/utils/dashboardState.ts b/apps/mobile/src/utils/dashboardState.tsindex 2571c7ab..8223be6c 100644--- a/apps/mobile/src/utils/dashboardState.ts+++ b/apps/mobile/src/utils/dashboardState.ts@@ -51,14 +51,10 @@ export interface StateInput {now?: Date}-const STOPPED_BY_BATTERY = "Battery fell below 5%"-const NO_FIX_YET = "No fix yet"-const LOCATION_OFF = "Location services are off"-function pauseCaption(zoneName: string, pauseReason: string | null): string {- if (pauseReason === "wifi") return `${zoneName} WiFi · resumes when you leave`- if (pauseReason === "motionless") return "No movement · resumes when you move"- return "Inside zone · resumes when you leave"+ if (pauseReason === "wifi") return t("state.pause.wifi", { zone: zoneName })+ if (pauseReason === "motionless") return t("state.pause.motionless")+ return t("state.pause.zone")}export function describeState(input: StateInput): StateDescription {@@ -66,12 +62,12 @@ export function describeState(input: StateInput): StateDescription {if (!tracking) {if (input.stoppedByBattery) {- return { icon: "alert", tone: "error", label: "Tracking stopped", caption: STOPPED_BY_BATTERY }+ return { icon: "alert", tone: "error", label: t("state.stopped"), caption: t("state.stoppedByBattery") }}return {icon: "dashed",tone: "secondary",- label: "Ready",+ label: t("state.ready"),caption: formatLastFix(input.lastKnown?.timestamp ?? null, input.now)}}@@ -80,7 +76,7 @@ export function describeState(input: StateInput): StateDescription {return {icon: "pause",tone: "secondary",- label: `Paused in ${activeZoneName}`,+ label: t("state.pausedIn", { zone: activeZoneName }),caption: pauseCaption(activeZoneName, pauseReason)}}@@ -89,8 +85,8 @@ export function describeState(input: StateInput): StateDescription {return {icon: "loader",tone: "primary",- label: "Searching for GPS",- caption: locationEnabled ? NO_FIX_YET : LOCATION_OFF+ label: t("state.searching"),+ caption: locationEnabled ? t("state.noFixYet") : t("state.locationOff")}}@@ -98,7 +94,7 @@ export function describeState(input: StateInput): StateDescription {return {icon: "circleDot",tone: "success",- label: activeProfileName ? `Tracking · ${activeProfileName}` : "Tracking",+ label: activeProfileName ? t("state.trackingProfile", { profile: activeProfileName }) : t("state.tracking"),caption: `±${accuracy} ${shortDistanceUnit()} · ${formatTime(coords.timestamp)}`}}@@ -165,6 +161,6 @@ export function intervalText(intervalSeconds: number, syncIntervalSeconds: numbe}export function formatLastFix(timestampSeconds: number | null, now: Date = new Date()): string {- if (timestampSeconds === null) return "No fixes yet"- return `Last fix ${formatWhen(timestampSeconds, now)}`+ if (timestampSeconds === null) return t("state.noFixes")+ return t("state.lastFix", { when: formatWhen(timestampSeconds, now) })}