Colota - Android GPS Location tracker
refactor(i18n): move Location history into the catalog (#907)
Max Dietrichd43fdab9b014
diff --git a/apps/mobile/src/components/features/inspector/CalendarPicker.tsx b/apps/mobile/src/components/features/inspector/CalendarPicker.tsxindex a752b540..9f6c6c74 100644--- a/apps/mobile/src/components/features/inspector/CalendarPicker.tsx+++ b/apps/mobile/src/components/features/inspector/CalendarPicker.tsx@@ -13,6 +13,7 @@ import { pad2 } from "../../../utils/format"import { size, space, STATE_LAYER_ALPHA } from "../../../constants"import { radius } from "@colota/shared"import { IconButton } from "../../ui/IconButton"+import { t } from "../../../i18n/t"interface CalendarPickerProps {date: Date@@ -24,8 +25,8 @@ interface CalendarPickerProps {onPrefetchMonth?: (year: number, month: number) => void}-const WEEKDAYS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]-const WEEK_LENGTH = WEEKDAYS.length+const WEEKDAY_KEYS = [1, 2, 3, 4, 5, 6, 7] as const+const WEEK_LENGTH = WEEKDAY_KEYS.lengthconst MONTH_LABELS = Array.from({ length: 12 }, (_, m) =>new Date(2000, m, 1).toLocaleDateString(undefined, { month: "short" }))@@ -48,22 +49,21 @@ function formatDateKey(year: number, month: number, day: number): string {return `${year}-${pad2(month + 1)}-${pad2(day)}`}-function plural(count: number, noun: string): string {- return `${count} ${count === 1 ? noun : `${noun}s`}`-}+const points = (n: number) => t("history.points", { count: n, n: n.toLocaleString() })+const trips = (n: number) => t("history.trips", { count: n, n })export function dayCellLabel(cellDate: Date, stat: DailyStat | undefined, isToday: boolean): string {const weekday = cellDate.toLocaleDateString(undefined, { weekday: "long" })const month = cellDate.toLocaleDateString(undefined, { month: "long" })- const parts = [`${weekday} ${cellDate.getDate()} ${month}`]+ const parts = [t("calendar.cellDate", { weekday, day: cellDate.getDate(), month })]if (!stat || stat.count === 0) {- parts.push("no data")+ parts.push(t("calendar.noData"))} else if (stat.tripCount === 0) {- parts.push("no trips", plural(stat.count, "point"))+ parts.push(t("day.noTrips"), points(stat.count))} else {- parts.push(plural(stat.tripCount, "trip"), spokenDistance(stat.distanceMeters), plural(stat.count, "point"))+ parts.push(trips(stat.tripCount), spokenDistance(stat.distanceMeters), points(stat.count))}- if (isToday) parts.push("today")+ if (isToday) parts.push(t("calendar.today"))return parts.join(", ")}@@ -198,7 +198,11 @@ export function CalendarPicker({const headerLabel = pane === "months" ? pickerYearLabel : monthLabelconst headerHint =- pane === "days" ? "Opens the year picker" : pane === "years" ? "Closes the year picker" : "Back to the year picker"+ pane === "days"+ ? t("calendar.opensYears")+ : pane === "years"+ ? t("calendar.closesYears")+ : t("calendar.backToYears")return (<View testID="calendar-picker">@@ -208,7 +212,7 @@ export function CalendarPicker({testID="prev-month-btn"icon={ChevronLeft}onPress={() => navigateMonth(-1)}- accessibilityLabel="Previous month"+ accessibilityLabel={t("calendar.previousMonth")}/>) : (<View style={styles.monthNavSpacer} />@@ -233,7 +237,7 @@ export function CalendarPicker({testID="next-month-btn"icon={ChevronRight}onPress={() => navigateMonth(1)}- accessibilityLabel="Next month"+ accessibilityLabel={t("calendar.nextMonth")}disabled={isFutureMonth}/>) : (@@ -301,9 +305,9 @@ export function CalendarPicker({{pane === "days" && (<><View style={styles.weekRow}>- {WEEKDAYS.map((day) => (+ {WEEKDAY_KEYS.map((day) => (<Text key={day} style={[styles.weekdayText, { color: colors.textSecondary }]}>- {day}+ {t(`calendar.weekday.${day}`)}</Text>))}</View>diff --git a/apps/mobile/src/components/features/inspector/DayHeader.tsx b/apps/mobile/src/components/features/inspector/DayHeader.tsxindex cf642680..cbc6ada7 100644--- a/apps/mobile/src/components/features/inspector/DayHeader.tsx+++ b/apps/mobile/src/components/features/inspector/DayHeader.tsx@@ -6,6 +6,8 @@import React from "react"import { formatDistance } from "../../../utils/geo"import { StepperHeader } from "../../ui/StepperHeader"+import { t } from "../../../i18n/t"+import { useTranslation } from "../../../i18n/useTranslation"export type DayStats = {points: number@@ -42,8 +44,8 @@ export function isRelativeDay(date: Date, now: Date = new Date()): boolean {export function dayTitle(date: Date, now: Date = new Date()): string {const days = daysBefore(date, now)- if (days === 0) return "Today"- if (days === 1) return "Yesterday"+ if (days === 0) return t("day.today")+ if (days === 1) return t("day.yesterday")return date.toLocaleDateString(undefined, {weekday: "short",month: "short",@@ -56,15 +58,14 @@ export function dayLongDate(date: Date, now: Date = new Date()): string {return date.toLocaleDateString(undefined, { weekday: "long", month: "long", day: "numeric", ...withYear(date, now) })}-function count(n: number, noun: string): string {- return `${n} ${noun}${n === 1 ? "" : "s"}`-}+const points = (n: number) => t("history.points", { count: n, n: n.toLocaleString() })+const trips = (n: number) => t("history.trips", { count: n, n })export function dayLedger(stats: DayStats | null, loading: boolean): string {- if (loading) return "Loading"- if (!stats || stats.points === 0) return "No locations recorded"- if (stats.trips === 0) return `${count(stats.points, "point")} · no trips`- return `${count(stats.trips, "trip")} · ${formatDistance(stats.distanceMeters)} · ${count(stats.points, "point")}`+ if (loading) return t("day.loading")+ if (!stats || stats.points === 0) return t("day.noLocations")+ if (stats.trips === 0) return `${points(stats.points)} · ${t("day.noTrips")}`+ return `${trips(stats.trips)} · ${formatDistance(stats.distanceMeters)} · ${points(stats.points)}`}export function dayCaption(date: Date, stats: DayStats | null, loading: boolean, now: Date = new Date()): string {@@ -74,6 +75,7 @@ export function dayCaption(date: Date, stats: DayStats | null, loading: boolean,}export function DayHeader({ date, stats, loading, onPrevious, onNext, onOpenPicker, nextDisabled }: DayHeaderProps) {+ useTranslation()const now = new Date()return (@@ -82,12 +84,12 @@ export function DayHeader({ date, stats, loading, onPrevious, onNext, onOpenPickcaption={dayCaption(date, stats, loading, now)}onPrevious={onPrevious}onNext={onNext}- previousLabel="Previous day"- nextLabel="Next day"+ previousLabel={t("day.previous")}+ nextLabel={t("day.next")}nextDisabled={nextDisabled}onPress={onOpenPicker}- accessibilityLabel={`Change day, ${dayLongDate(date, now)}, ${dayLedger(stats, loading)}`}- accessibilityHint="Opens the calendar"+ accessibilityLabel={t("day.change", { date: dayLongDate(date, now), ledger: dayLedger(stats, loading) })}+ accessibilityHint={t("day.opensCalendar")}testID="day"/>)diff --git a/apps/mobile/src/components/features/inspector/DayPickerModal.tsx b/apps/mobile/src/components/features/inspector/DayPickerModal.tsxindex 5bde3410..8e121e7e 100644--- a/apps/mobile/src/components/features/inspector/DayPickerModal.tsx+++ b/apps/mobile/src/components/features/inspector/DayPickerModal.tsx@@ -9,6 +9,7 @@ import { useTheme } from "../../../hooks/useTheme"import { DialogShell } from "../../ui/DialogShell"import { Button } from "../../ui/Button"import { CalendarPicker } from "./CalendarPicker"+import { t } from "../../../i18n/t"interface DayPickerModalProps {visible: boolean@@ -46,7 +47,9 @@ export function DayPickerModal({visible={visible}onRequestClose={onRequestClose}gutter="picker"- footer={<Button variant="ghost" title="Close" onPress={onRequestClose} testID="day-picker-close-btn" />}+ footer={+ <Button variant="ghost" title={t("common.close")} onPress={onRequestClose} testID="day-picker-close-btn" />+ }><CalendarPickerdate={date}diff --git a/apps/mobile/src/components/features/inspector/InspectorDock.tsx b/apps/mobile/src/components/features/inspector/InspectorDock.tsxindex 2bf1a7cb..c10c1ab0 100644--- a/apps/mobile/src/components/features/inspector/InspectorDock.tsx+++ b/apps/mobile/src/components/features/inspector/InspectorDock.tsx@@ -18,6 +18,7 @@ import { MapDock } from "../../ui/MapDock"import { StateLine } from "../../ui/StateLine"import { PointCard, type PointCardProps } from "./PointCard"import { TripRow, TripSwatch } from "./TripRow"+import { t } from "../../../i18n/t"export type DockEmptyAction = {icon: LucideIcon@@ -55,7 +56,7 @@ function TripChip({ trip, selected, onPress }: TripChipProps) {<PressabletestID={`dock-trip-${trip.index}`}accessibilityRole="button"- accessibilityLabel={`Trip ${trip.index}, starts ${start}`}+ accessibilityLabel={t("dock.tripStarts", { index: trip.index, time: start })}accessibilityState={{ selected }}android_ripple={{ color: colors.text + STATE_LAYER_ALPHA }}hitSlop={HIT_SLOP_MD}@@ -91,7 +92,7 @@ function Legend({ trips, focusedTripIndex, onFocusTrip }: Extract<DockContent, {<StateLineicon={Route}iconColor={colors.textSecondary}- label={`${trips.length} ${trips.length === 1 ? "trip" : "trips"}`}+ label={t("history.trips", { count: trips.length, n: trips.length })}caption={`${formatTime(first.startTime)} - ${formatTime(last.endTime)} · ${formatDistance(distance)}`}testID="dock-legend"/>@@ -125,12 +126,12 @@ function DockBody({ content }: { content: DockContent }) {return <Legend {...content} />case "points": {const { count, startTime, endTime } = content- const points = `${count} ${count === 1 ? "point" : "points"}`+ const points = t("history.points", { count, n: count.toLocaleString() })return (<StateLineicon={MapPin}iconColor={colors.textSecondary}- label="No trips"+ label={t("history.noTrips.title")}caption={`${points} · ${formatTime(startTime)} - ${formatTime(endTime)}`}testID="dock-points"/>diff --git a/apps/mobile/src/components/features/inspector/LocationTable.tsx b/apps/mobile/src/components/features/inspector/LocationTable.tsxindex 3374e4b9..1e7e1854 100644--- a/apps/mobile/src/components/features/inspector/LocationTable.tsx+++ b/apps/mobile/src/components/features/inspector/LocationTable.tsx@@ -19,6 +19,7 @@ import { LocationCoords, ThemeColors } from "../../../types/global"import { formatTime, getSpeedUnit, getTimeFormat } from "../../../utils/geo"import { size, space, STATE_LAYER_ALPHA } from "../../../constants"import { Divider } from "../../ui/Divider"+import { t } from "../../../i18n/t"interface Props {locations: LocationCoords[]@@ -49,7 +50,7 @@ const COLUMN_WIDTHS = {// "10:17:10 PM" is three characters wider than "22:17:10".const TIME_WIDTH = { "24h": 88, "12h": 112 } as constconst ROW_LENGTH = size.touch + StyleSheet.hairlineWidth-const POWER_WORDS: Record<number, string> = { 1: "Unplugged", 2: "Charging", 3: "Full" }+const isPowerStatus = (status: number): status is 1 | 2 | 3 => status >= 1 && status <= 3function val(v?: number | null, decimals = 0): string {if (v == null) return "-"@@ -79,7 +80,7 @@ const TimeCell = React.memo(({ item, colors, selected, onSelectPoint }: RowPropsstyle={[styles.row, selected && { backgroundColor: colors.primaryContainer }]}android_ripple={{ color: colors.text + STATE_LAYER_ALPHA }}accessibilityRole="button"- accessibilityLabel={`${timeOf(item)}, show on map`}+ accessibilityLabel={t("table.timeShowOnMap", { time: timeOf(item) })}accessibilityState={{ selected }}onPress={() => item.id != null && onSelectPoint(item.id)}>@@ -105,21 +106,29 @@ const DataRow = React.memo(speedUnit,hasEndpoint}: RowProps & { speedUnit: { factor: number; unit: string }; hasEndpoint: boolean }) => {- const power = POWER_WORDS[item.battery_status ?? 0]+ const status = item.battery_status ?? 0+ const powerKey = isPowerStatus(status) ? status : undefined+ const power = powerKey ? t(`table.power.${powerKey}`) : undefinedconst battery = item.battery != null ? `${item.battery}%` : "-"- const syncWord = item.sent ? "Sent" : "Queued"+ const syncWord = item.sent ? t("point.sent") : t("point.queued")const facts = [timeOf(item),- item.delta != null ? `${item.delta} seconds after the previous point` : null,+ item.delta != null ? t("table.fact.delta", { count: item.delta, n: item.delta }) : null,`${val(item.latitude, 5)}, ${val(item.longitude, 5)}`,- `accuracy ${val(item.accuracy)} m`,- item.speed != null ? `speed ${(item.speed * speedUnit.factor).toFixed(1)} ${speedUnit.unit}` : null,- item.altitude != null ? `altitude ${val(item.altitude)} m` : null,- item.bearing != null ? `bearing ${val(item.bearing)}` : null,- item.battery != null ? `battery ${battery}${power ? ` ${power.toLowerCase()}` : ""}` : null,+ t("table.fact.accuracy", { value: val(item.accuracy) }),+ item.speed != null+ ? t("table.fact.speed", { value: (item.speed * speedUnit.factor).toFixed(1), unit: speedUnit.unit })+ : null,+ item.altitude != null ? t("table.fact.altitude", { value: val(item.altitude) }) : null,+ item.bearing != null ? t("table.fact.bearing", { value: val(item.bearing) }) : null,+ item.battery != null+ ? powerKey+ ? t("table.fact.batteryPower", { level: battery, power: t(`table.power.${powerKey}.clause`) })+ : t("table.fact.battery", { level: battery })+ : null,hasEndpoint ? syncWord : null,- item.note ? `note ${item.note}` : null,- "show on map"+ item.note ? t("table.fact.note", { note: item.note }) : null,+ t("table.showOnMap")].filter(Boolean)const content = selected ? colors.onPrimaryContainer : colors.textconst mono = [styles.mono, styles.numeric, { color: content }]@@ -240,7 +249,7 @@ export function LocationTable({ locations, colors, hasEndpoint, selectedPointId,><View style={styles.headerRow}><Text style={[header, { width: TIME_WIDTH[getTimeFormat()] }]} numberOfLines={2}>- Time+ {t("table.col.time")}</Text></View><Divider tight />@@ -263,39 +272,39 @@ export function LocationTable({ locations, colors, hasEndpoint, selectedPointId,<View style={{ width: dataWidth }}><View style={styles.headerRow}><Text style={[numericHeader, { width: COLUMN_WIDTHS.delta }]} numberOfLines={2}>- Since last fix+ {t("table.col.since")}</Text><Text style={[numericHeader, { width: COLUMN_WIDTHS.lat }]} numberOfLines={2}>- Lat+ {t("table.col.lat")}</Text><Text style={[numericHeader, { width: COLUMN_WIDTHS.lon }]} numberOfLines={2}>- Lon+ {t("table.col.lon")}</Text><Text style={[numericHeader, { width: COLUMN_WIDTHS.acc }]} numberOfLines={2}>- Acc m+ {t("table.col.acc")}</Text><Text style={[numericHeader, { width: COLUMN_WIDTHS.speed }]} numberOfLines={2}>- {`Speed ${speedUnit.unit}`}+ {t("table.col.speed", { unit: speedUnit.unit })}</Text><Text style={[numericHeader, { width: COLUMN_WIDTHS.alt }]} numberOfLines={2}>- Alt m+ {t("table.col.alt")}</Text><Text style={[numericHeader, { width: COLUMN_WIDTHS.bear }]} numberOfLines={2}>- Bear+ {t("table.col.bear")}</Text><Text style={[numericHeader, { width: COLUMN_WIDTHS.batt }]} numberOfLines={2}>- Batt %+ {t("table.col.batt")}</Text><Text style={[header, { width: COLUMN_WIDTHS.power }]} numberOfLines={2}>- Power+ {t("table.col.power")}</Text>{hasEndpoint && (<Text style={[header, { width: COLUMN_WIDTHS.sync }]} numberOfLines={2}>- Sync+ {t("table.col.sync")}</Text>)}<Text style={[header, { width: COLUMN_WIDTHS.note }]} numberOfLines={2}>- Note+ {t("table.col.note")}</Text></View><Divider tight />diff --git a/apps/mobile/src/components/features/inspector/PointCard.tsx b/apps/mobile/src/components/features/inspector/PointCard.tsxindex 69477cc8..46921d89 100644--- a/apps/mobile/src/components/features/inspector/PointCard.tsx+++ b/apps/mobile/src/components/features/inspector/PointCard.tsx@@ -16,6 +16,7 @@ import { Divider } from "../../ui/Divider"import { IconButton } from "../../ui/IconButton"import { ListItem } from "../../ui/ListItem"import { StatRow } from "../../ui/StatRow"+import { useTranslation } from "../../../i18n/useTranslation"export type PointCardProps = {point: LocationCoords@@ -31,14 +32,15 @@ export type PointCardProps = {export function PointCard({ point, note, hasEndpoint, onSplit, onDelete, onClose, onSaveNote }: PointCardProps) {const { colors } = useTheme()+ const { t } = useTranslation()const editNote = async () => {const next = await showPrompt({- title: "Note",- placeholder: "Add a note",+ title: t("point.note"),+ placeholder: t("point.addNote"),initialValue: note ?? "",multiline: true,- cancelText: "Close"+ cancelText: t("common.close")})if (next !== null) onSaveNote(next ? next : null)}@@ -53,23 +55,23 @@ export function PointCard({ point, note, hasEndpoint, onSplit, onDelete, onClose{formatTime(point.timestamp ?? 0, true)}</Text>{onSplit && (- <IconButton icon={Split} accessibilityLabel="Start a new trip here" onPress={onSplit} testID="point-split" />+ <IconButton icon={Split} accessibilityLabel={t("point.split")} onPress={onSplit} testID="point-split" />)}{onDelete && (<IconButtonicon={Trash2}tone="danger"- accessibilityLabel="Delete point"+ accessibilityLabel={t("point.delete")}onPress={onDelete}testID="point-delete"/>)}- <IconButton icon={X} accessibilityLabel="Close" onPress={onClose} testID="point-close" />+ <IconButton icon={X} accessibilityLabel={t("common.close")} onPress={onClose} testID="point-close" /></View>{point.speed !== undefined && (<><Divider tight inset />- <StatRow icon={Gauge} label="Speed" value={formatSpeed(point.speed)} testID="point-speed" />+ <StatRow icon={Gauge} label={t("point.speed")} value={formatSpeed(point.speed)} testID="point-speed" /></>)}{point.accuracy !== undefined && (@@ -77,7 +79,7 @@ export function PointCard({ point, note, hasEndpoint, onSplit, onDelete, onClose<Divider tight inset /><StatRowicon={Crosshair}- label="Accuracy"+ label={t("point.accuracy")}value={`±${Math.round(point.accuracy)} m`}testID="point-accuracy"/>@@ -86,20 +88,30 @@ export function PointCard({ point, note, hasEndpoint, onSplit, onDelete, onClose{point.altitude !== undefined && (<><Divider tight inset />- <StatRow icon={Mountain} label="Altitude" value={`${Math.round(point.altitude)} m`} testID="point-altitude" />+ <StatRow+ icon={Mountain}+ label={t("point.altitude")}+ value={`${Math.round(point.altitude)} m`}+ testID="point-altitude"+ /></>)}{hasEndpoint && (<><Divider tight inset />- <StatRow icon={CloudUpload} label="Sync" value={point.sent ? "Sent" : "Queued"} testID="point-sync" />+ <StatRow+ icon={CloudUpload}+ label={t("point.sync")}+ value={point.sent ? t("point.sent") : t("point.queued")}+ testID="point-sync"+ /></>)}<Divider tight inset /><ListItemicon={NotebookPen}- label="Note"- sub={note ? note : "Add a note"}+ label={t("point.note")}+ sub={note ? note : t("point.addNote")}onPress={editNote}testID="point-note"/>diff --git a/apps/mobile/src/components/features/inspector/TrackMap.tsx b/apps/mobile/src/components/features/inspector/TrackMap.tsxindex c86550b3..c6db5972 100644--- a/apps/mobile/src/components/features/inspector/TrackMap.tsx+++ b/apps/mobile/src/components/features/inspector/TrackMap.tsx@@ -22,6 +22,7 @@ import {type TrackLocation} from "../map/mapUtils"import { DEFAULT_MAP_ZOOM, MAP_ANIMATION_DURATION_MS, WORLD_MAP_ZOOM, size, space } from "../../../constants"+import { t } from "../../../i18n/t"const FOCUSED_FILTER: ["==", ["get", "focused"], true] = ["==", ["get", "focused"], true]const START_FILTER: ["==", ["get", "kind"], "start"] = ["==", ["get", "kind"], "start"]@@ -232,10 +233,10 @@ export function TrackMap({const terminalsGeoJSON = useMemo(() => {const terminalTrips = trips- ? trips.map((t) => ({- index: t.index,- color: getTripColor(t.index),- locations: locations.slice(t.startIndex, t.startIndex + t.locationCount)+ ? trips.map((trip) => ({+ index: trip.index,+ color: getTripColor(trip.index),+ locations: locations.slice(trip.startIndex, trip.startIndex + trip.locationCount)})): [{ index: 0, color: trackColor, locations }]return buildTripTerminalsGeoJSON(terminalTrips, focusedTripIndex)@@ -382,7 +383,7 @@ export function TrackMap({anchored={false}style={[styles.fitDay, { bottom: controlsBottom + size.iconColumn + space.lg, right: controlsEnd }]}accessibilityRole="button"- accessibilityLabel="Fit the day"+ accessibilityLabel={t("trackMap.fit")}><LocateFixed size={size.icon.md} color={colors.textLight} /></MapActionButton>diff --git a/apps/mobile/src/components/features/inspector/TripRow.tsx b/apps/mobile/src/components/features/inspector/TripRow.tsxindex bcc44dde..016441fe 100644--- a/apps/mobile/src/components/features/inspector/TripRow.tsx+++ b/apps/mobile/src/components/features/inspector/TripRow.tsx@@ -13,6 +13,8 @@ import { size, space, STATE_LAYER_ALPHA } from "../../../constants"import { formatDistance, formatDuration, formatSpeed, formatTime, spokenDistance } from "../../../utils/geo"import { computeTripStats, getTripColor } from "../../../utils/trips"import type { Trip } from "../../../types/global"+import { t } from "../../../i18n/t"+import { useTranslation } from "../../../i18n/useTranslation"type TripRowProps = {trip: Trip@@ -29,8 +31,8 @@ function spokenDuration(seconds: number): string {const hours = Math.floor(s / 3600)const minutes = Math.floor((s % 3600) / 60)const parts: string[] = []- if (hours > 0) parts.push(`${hours} ${hours === 1 ? "hour" : "hours"}`)- parts.push(`${minutes} ${minutes === 1 ? "minute" : "minutes"}`)+ if (hours > 0) parts.push(t("trip.hours", { count: hours, n: hours }))+ parts.push(t("trip.minutes", { count: minutes, n: minutes }))return parts.join(" ")}@@ -41,6 +43,7 @@ export function TripSwatch({ index }: { index: number }) {export function TripRow({ trip, index, selected, selecting, onPress, onLongPress, testID }: TripRowProps) {const { colors } = useTheme()+ useTranslation()const duration = trip.endTime - trip.startTimeconst avgSpeed = useMemo(() => computeTripStats(trip.locations).avgSpeed, [trip.locations])const start = formatTime(trip.startTime)@@ -56,8 +59,14 @@ export function TripRow({ trip, index, selected, selecting, onPress, onLongPress<PressabletestID={testID}accessibilityRole="button"- accessibilityLabel={`Trip ${index}, ${start} to ${end}, ${spokenDistance(trip.distance)}, ${spokenDuration(duration)}`}- accessibilityHint={selecting ? undefined : "Opens trip details"}+ accessibilityLabel={t("trip.a11y", {+ index,+ start,+ end,+ distance: spokenDistance(trip.distance),+ duration: spokenDuration(duration)+ })}+ accessibilityHint={selecting ? undefined : t("trip.opensDetails")}accessibilityState={{ selected }}android_ripple={{ color: colors.text + STATE_LAYER_ALPHA }}onPress={onPress}diff --git a/apps/mobile/src/components/features/map/ColotaMapView.tsx b/apps/mobile/src/components/features/map/ColotaMapView.tsxindex caae94df..615a7f43 100644--- a/apps/mobile/src/components/features/map/ColotaMapView.tsx+++ b/apps/mobile/src/components/features/map/ColotaMapView.tsx@@ -32,6 +32,9 @@ import { Divider } from "../../ui/Divider"import { ListItem } from "../../ui/ListItem"import { Button } from "../../ui/Button"import { logger } from "../../../utils/logger"+import { t } from "../../../i18n/t"+import { useTranslation } from "../../../i18n/useTranslation"+import type { TranslationKey } from "../../../i18n/options"interface AttributionLink {url: string@@ -49,11 +52,11 @@ const FALLBACK_ATTRIBUTION_LINKS: AttributionLink[] = []/** What each known source contributes; a custom tile server's own credits show without a role. */-const ATTRIBUTION_ROLES: Record<string, string> = {- "openstreetmap.org": "Map data",- "openmaptiles.org": "Tile schema and base styles",- "openfreemap.org": "Planet tiles, rebuilt weekly",- "maps.mxd.codes": "Tile hosting and the Colota styles"+const ATTRIBUTION_ROLES: Record<string, TranslationKey> = {+ "openstreetmap.org": "map.role.osm",+ "openmaptiles.org": "map.role.omt",+ "openfreemap.org": "map.role.ofm",+ "maps.mxd.codes": "map.role.mxd"}/** The credits come from the style JSON, so key on the host itself and not on a link that names one. */@@ -69,7 +72,7 @@ function attributionHost(url: string): string {export function attributionRole(url: string): string | undefined {const host = attributionHost(url)const known = Object.keys(ATTRIBUTION_ROLES).find((name) => host === name || host.endsWith(`.${name}`))- return known ? ATTRIBUTION_ROLES[known] : undefined+ return known ? t(ATTRIBUTION_ROLES[known]) : undefined}function parseAttributionLinks(htmls: string[]): AttributionLink[] {@@ -162,6 +165,7 @@ export const ColotaMapView = forwardRef<ColotaMapRef, Props>(function ColotaMapVconst cameraRef = useRef<CameraRef>(null)const mapViewRef = useRef<MapRef>(null)const { colors, mode } = useTheme()+ useTranslation()const isDark = mode === "dark"const [mapStyleLight, setMapStyleLight] = useState(MAP_STYLE_URL_LIGHT)@@ -308,7 +312,7 @@ export const ColotaMapView = forwardRef<ColotaMapRef, Props>(function ColotaMapVonPress={handleCompassPress}style={compassStyle}accessibilityRole="button"- accessibilityLabel="Reset map to north"+ accessibilityLabel={t("map.north")}><View style={{ transform: [{ rotate: `${-heading}deg` }] }}><Compass size={size.icon.md} color={colors.textLight} />@@ -322,16 +326,16 @@ export const ColotaMapView = forwardRef<ColotaMapRef, Props>(function ColotaMapVonPress={() => setAttributionOpen(true)}style={attributionStyle}accessibilityRole="button"- accessibilityLabel="Show map attribution"+ accessibilityLabel={t("map.showAttribution")}><Info size={size.icon.md} color={colors.textLight} /></MapActionButton><DialogShellvisible={attributionOpen}- title="Map credits"+ title={t("map.credits")}onRequestClose={() => setAttributionOpen(false)}- footer={<Button title="Close" variant="ghost" onPress={() => setAttributionOpen(false)} />}+ footer={<Button title={t("common.close")} variant="ghost" onPress={() => setAttributionOpen(false)} />}><View style={styles.attributionRows}>{attributionLinks.map((link, i) => (diff --git a/apps/mobile/src/components/features/map/MapCenterButton.tsx b/apps/mobile/src/components/features/map/MapCenterButton.tsxindex b426bdc7..9fb494b8 100644--- a/apps/mobile/src/components/features/map/MapCenterButton.tsx+++ b/apps/mobile/src/components/features/map/MapCenterButton.tsx@@ -9,6 +9,7 @@ import { LocateFixed } from "lucide-react-native"import { useTheme } from "../../../hooks/useTheme"import { MapActionButton, mapActionStyles } from "./MapActionButton"import { size, space } from "../../../constants"+import { useTranslation } from "../../../i18n/useTranslation"interface Props {onPress: () => void@@ -18,6 +19,7 @@ interface Props {export const MapCenterButton: React.FC<Props> = ({ onPress, visible, style }) => {const { colors } = useTheme()+ const { t } = useTranslation()if (!visible) return null@@ -26,7 +28,7 @@ export const MapCenterButton: React.FC<Props> = ({ onPress, visible, style }) =>onPress={onPress}style={[mapActionStyles.right, styles.position, style]}accessibilityRole="button"- accessibilityLabel="Centre map on my position"+ accessibilityLabel={t("map.centre")}><LocateFixed size={size.icon.md} color={colors.textLight} /></MapActionButton>diff --git a/apps/mobile/src/components/features/map/TrackToggleButton.tsx b/apps/mobile/src/components/features/map/TrackToggleButton.tsxindex 2abd64ee..3d9b8284 100644--- a/apps/mobile/src/components/features/map/TrackToggleButton.tsx+++ b/apps/mobile/src/components/features/map/TrackToggleButton.tsx@@ -8,6 +8,7 @@ import { Route, RouteOff } from "lucide-react-native"import { useTheme } from "../../../hooks/useTheme"import { MapActionButton, mapActionStyles } from "./MapActionButton"import { size } from "../../../constants"+import { useTranslation } from "../../../i18n/useTranslation"interface Props {onPress: () => void@@ -17,6 +18,7 @@ interface Props {export function TrackToggleButton({ onPress, active, anchored = true }: Props) {const { colors } = useTheme()+ const { t } = useTranslation()return (<MapActionButton@@ -24,7 +26,7 @@ export function TrackToggleButton({ onPress, active, anchored = true }: Props) {style={anchored && mapActionStyles.left}anchored={anchored}accessibilityRole="button"- accessibilityLabel={active ? "Hide today's track" : "Show today's track"}+ accessibilityLabel={active ? t("map.hideTrack") : t("map.showTrack")}accessibilityState={{ selected: active }}>{active ? (diff --git a/apps/mobile/src/i18n/locales/en.json b/apps/mobile/src/i18n/locales/en.jsonindex e24e1457..e5b01140 100644--- a/apps/mobile/src/i18n/locales/en.json+++ b/apps/mobile/src/i18n/locales/en.json@@ -348,6 +348,7 @@"condition.stationary.clause": "when stationary","condition.stationary.description": "Phone stays still for the activation delay","common.delete": "Delete",+ "common.close": "Close","tracking.recording.whileStill": "Every {{duration}} while still","tracking.phrase.anyMovement": "every {{duration}}, any movement","tracking.phrase.after": "every {{duration}} after {{distance}}",@@ -451,5 +452,154 @@"placeZone.here": "Place zone at my position","placeZone.readout": "{{coord}} · {{radius}} radius","placeZone.tap": "Tap the map to place the zone",- "placeZone.use": "Use this location"+ "placeZone.use": "Use this location",+ "history.points_one": "{{n}} point",+ "history.points_other": "{{n}} points",+ "history.trips_one": "{{n}} trip",+ "history.trips_other": "{{n}} trips",+ "history.empty.nothingRecorded": "Nothing recorded",+ "history.empty.noLocationsYet": "No locations yet",+ "history.empty.noLocationsYet.hint": "Tracking is on. The first fix lands here.",+ "history.empty.noLocationsToday": "No locations today",+ "history.empty.trackingOff": "Tracking is off.",+ "history.empty.nothingYet": "Nothing recorded yet",+ "history.empty.nothingYet.hint": "Start tracking on the Dashboard and today's track appears here.",+ "history.loadFailed.title": "Load Failed",+ "history.loadFailed.message": "Unable to load this day. Please try again.",+ "history.trip": "Trip {{index}}",+ "history.tripsLabel": "Trips",+ "history.shareSubject": "Colota {{label}} - {{date}}",+ "history.exportFailed.title": "Export Failed",+ "history.exportFailed.message": "Unable to export. Please try again.",+ "history.exportDay": "Export day",+ "history.exportTrip": "Export Trip {{index}}",+ "history.exportTrips_one": "Export {{n}} trip",+ "history.exportTrips_other": "Export {{n}} trips",+ "history.merge.title": "Merge trips",+ "history.merge.adjacent": "Select two or more trips that follow each other.",+ "history.merge.adjacentHint": "Select two or more trips that follow each other",+ "history.merge.confirmPair": "Trips {{first}} and {{last}} will be combined into one.",+ "history.merge.confirmRange": "Trips {{first}}-{{last}} will be combined into one.",+ "history.merge.confirm": "Merge",+ "history.merge.failed.title": "Merge Failed",+ "history.merge.failed.message": "Unable to merge the selected trips. Please try again.",+ "history.deleteTrip.title": "Delete Trip {{index}}?",+ "history.deleteTrips.title_one": "Delete {{n}} trip?",+ "history.deleteTrips.title_other": "Delete {{n}} trips?",+ "history.deleteTrips.message_one": "Removes {{n}} location point from this device only. Already-synced points remain on your server. Unsent points will not be uploaded.",+ "history.deleteTrips.message_other": "Removes {{n}} location points from this device only. Already-synced points remain on your server. Unsent points will not be uploaded.",+ "history.delete.failed.title": "Delete Failed",+ "history.deleteTrips.failed": "Unable to delete selection. Please try again.",+ "history.selection.title": "Selection",+ "history.selection.message_one": "{{n}} of {{total}} trips selected",+ "history.selection.message_other": "{{n}} of {{total}} trips selected",+ "history.selection.all": "Select all",+ "history.selection.clear": "Clear selection",+ "history.selection.count": "{{n}} selected",+ "history.selection.cleared": "Selection cleared",+ "history.action.exportSelected": "Export selected trips",+ "history.action.deleteTrips": "Delete trips",+ "history.action.more": "More",+ "history.action.today": "Go to today",+ "history.deletePoint.titleAt": "Delete the point at {{time}}?",+ "history.deletePoint.title": "Delete Point?",+ "history.deletePoint.message": "Removes this point from this device only. If it has already synced it stays on your server, and if it has not it will never be uploaded.",+ "history.deletePoint.failed": "Unable to delete point. Please try again.",+ "history.note.failed.title": "Save Failed",+ "history.note.failed.message": "Unable to save note. Please try again.",+ "history.lastDay": "Last day with data",+ "history.openDashboard": "Open Dashboard",+ "history.trackingOff": "Tracking is off",+ "history.tab.map": "Map",+ "history.tab.trips": "Trips",+ "history.tab.data": "Data",+ "history.noTrips.title": "No trips",+ "history.noTrips.hint_one": "{{n}} point was recorded but none spread more than 100 m",+ "history.noTrips.hint_other": "{{n}} points were recorded but none spread more than 100 m",+ "history.noTrips.show": "Show points",+ "history.action.summary": "Location summary",+ "day.today": "Today",+ "day.yesterday": "Yesterday",+ "day.loading": "Loading",+ "day.noLocations": "No locations recorded",+ "day.noTrips": "no trips",+ "day.previous": "Previous day",+ "day.next": "Next day",+ "day.change": "Change day, {{date}}, {{ledger}}",+ "day.opensCalendar": "Opens the calendar",+ "calendar.cellDate": "{{weekday}} {{day}} {{month}}",+ "calendar.noData": "no data",+ "calendar.today": "today",+ "calendar.opensYears": "Opens the year picker",+ "calendar.closesYears": "Closes the year picker",+ "calendar.backToYears": "Back to the year picker",+ "calendar.previousMonth": "Previous month",+ "calendar.nextMonth": "Next month",+ "trackMap.fit": "Fit the day",+ "dock.tripStarts": "Trip {{index}}, starts {{time}}",+ "point.note": "Note",+ "point.addNote": "Add a note",+ "point.split": "Start a new trip here",+ "point.delete": "Delete point",+ "point.speed": "Speed",+ "point.accuracy": "Accuracy",+ "point.altitude": "Altitude",+ "point.sync": "Sync",+ "point.sent": "Sent",+ "point.queued": "Queued",+ "trip.hours_one": "{{n}} hour",+ "trip.hours_other": "{{n}} hours",+ "trip.minutes_one": "{{n}} minute",+ "trip.minutes_other": "{{n}} minutes",+ "trip.a11y": "Trip {{index}}, {{start}} to {{end}}, {{distance}}, {{duration}}",+ "trip.opensDetails": "Opens trip details",+ "table.power.1": "Unplugged",+ "table.power.2": "Charging",+ "table.power.3": "Full",+ "table.power.1.clause": "unplugged",+ "table.power.2.clause": "charging",+ "table.power.3.clause": "full",+ "table.showOnMap": "show on map",+ "table.timeShowOnMap": "{{time}}, show on map",+ "table.fact.accuracy": "accuracy {{value}} m",+ "table.fact.speed": "speed {{value}} {{unit}}",+ "table.fact.altitude": "altitude {{value}} m",+ "table.fact.bearing": "bearing {{value}}",+ "table.fact.battery": "battery {{level}}",+ "table.fact.batteryPower": "battery {{level}} {{power}}",+ "table.fact.note": "note {{note}}",+ "table.col.time": "Time",+ "table.col.since": "Since last fix",+ "table.col.lat": "Lat",+ "table.col.lon": "Lon",+ "table.col.acc": "Acc m",+ "table.col.speed": "Speed {{unit}}",+ "table.col.alt": "Alt m",+ "table.col.bear": "Bear",+ "table.col.batt": "Batt %",+ "table.col.power": "Power",+ "table.col.sync": "Sync",+ "table.col.note": "Note",+ "map.role.osm": "Map data",+ "map.role.omt": "Tile schema and base styles",+ "map.role.ofm": "Planet tiles, rebuilt weekly",+ "map.role.mxd": "Tile hosting and the Colota styles",+ "map.north": "Reset map to north",+ "map.showAttribution": "Show map attribution",+ "map.credits": "Map credits",+ "map.hideTrack": "Hide today's track",+ "map.showTrack": "Show today's track",+ "map.centre": "Centre map on my position",+ "history.action.exitSelection": "Exit selection",+ "calendar.weekday.1": "Mo",+ "calendar.weekday.2": "Tu",+ "calendar.weekday.3": "We",+ "calendar.weekday.4": "Th",+ "calendar.weekday.5": "Fr",+ "calendar.weekday.6": "Sa",+ "calendar.weekday.7": "Su",+ "history.merge.confirmTitle_one": "Merge {{n}} trips?",+ "history.merge.confirmTitle_other": "Merge {{n}} trips?",+ "table.fact.delta_one": "{{n}} second after the previous point",+ "table.fact.delta_other": "{{n}} seconds after the previous point"}diff --git a/apps/mobile/src/screens/LocationInspectorScreen.tsx b/apps/mobile/src/screens/LocationInspectorScreen.tsxindex da54ac02..8b6e1efd 100644--- a/apps/mobile/src/screens/LocationInspectorScreen.tsx+++ b/apps/mobile/src/screens/LocationInspectorScreen.tsx@@ -61,18 +61,19 @@ import {} from "../utils/inspectorDay"import { showAlert, showChoice, showConfirm } from "../services/modalService"import type { RootScreenProps } from "../types/navigation"+import { useTranslation } from "../i18n/useTranslation"+import { t as translate } from "../i18n/t"import { LOADING_INDICATOR_DELAY_MS, size, space } from "../constants"type TabType = "map" | "trips" | "data"-// setOptions cannot unset a key, so leaving selection writes the SCREEN_CONFIG title back.-const SCREEN_TITLE = "Location history"const NO_SELECTION = new Set<number>()type ExportRequest = { title: string; message: string; resolve: (format: ExportFormat | null) => void }export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Location History">) {const { colors } = useTheme()+ const { t } = useTranslation()const { settings, tracking } = useTracking()const insets = useSafeAreaInsets()const { height: windowHeight } = useWindowDimensions()@@ -112,7 +113,7 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo() => segmentTrips(trackLocations, undefined, boundaryOverrides),[trackLocations, boundaryOverrides])- const dayDistanceMeters = useMemo(() => trips.reduce((sum, t) => sum + t.distance, 0), [trips])+ const dayDistanceMeters = useMemo(() => trips.reduce((sum, trip) => sum + trip.distance, 0), [trips])const dayStats: DayStats | null =trackLocations.length === 0? null@@ -201,7 +202,8 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"LosetFocusedTripIndex(null)setFitVersion((v) => v + 1)setLoading(false)- showAlert("Load Failed", "Unable to load this day. Please try again.", "error")+ // The non-hook t, so a language change never refetches the day and drops the selection.+ showAlert(translate("history.loadFailed.title"), translate("history.loadFailed.message"), "error")}}, [mapDate, prefetchMonth])@@ -257,9 +259,9 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo// Trip Detail renders what it is handed, so notes saved this visit have to travel with it.const openTrip = useCallback((index: number) => {- const trip = trips.find((t) => t.index === index)+ const trip = trips.find((candidate) => candidate.index === index)if (!trip) return- const withSessionNotes = (t: Trip) => ({ ...t, locations: withNotes(t.locations) })+ const withSessionNotes = (value: Trip) => ({ ...value, locations: withNotes(value.locations) })navigation.navigate("Trip Detail", { trip: withSessionNotes(trip), trips: trips.map(withSessionNotes) })},[navigation, trips, withNotes]@@ -271,27 +273,31 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lotry {const dateStr = mapDate.toISOString().slice(0, 10)const isSingle = tripsToExport.length === 1- const label = isSingle ? `Trip ${tripsToExport[0].index}` : "Trips"+ const label = isSingle ? t("history.trip", { index: tripsToExport[0].index }) : t("history.tripsLabel")const fileName = `colota_${isSingle ? `trip${tripsToExport[0].index}` : "trips"}_${dateStr}${EXPORT_FORMATS[format].extension}`const filePath = await NativeLocationService.exportTripsToFile(- tripsToExport.map((t) => ({- index: t.index,- color: getTripColor(t.index),- startTs: t.startTime,- endTs: t.endTime+ tripsToExport.map((trip) => ({+ index: trip.index,+ color: getTripColor(trip.index),+ startTs: trip.startTime,+ endTs: trip.endTime})),format,fileName)- await NativeLocationService.shareFile(filePath, EXPORT_FORMATS[format].mimeType, `Colota ${label} - ${dateStr}`)+ await NativeLocationService.shareFile(+ filePath,+ EXPORT_FORMATS[format].mimeType,+ t("history.shareSubject", { label, date: dateStr })+ )} catch (error) {logger.error("[LocationHistory] Trip export failed:", error)- showAlert("Export Failed", "Unable to export. Please try again.", "error")+ showAlert(t("history.exportFailed.title"), t("history.exportFailed.message"), "error")}},- [mapDate]+ [mapDate, t])const [exportRequest, setExportRequest] = useState<ExportRequest | null>(null)@@ -310,40 +316,42 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Loconst handleExportDay = useCallback(async () => {const format = await chooseExportFormat(- "Export day",+ t("history.exportDay"),exportMessage(dayTitle(mapDate), trips.length, dayDistanceMeters))if (format) await exportTrips(format, trips)- }, [mapDate, trips, dayDistanceMeters, exportTrips, chooseExportFormat])+ }, [mapDate, trips, dayDistanceMeters, exportTrips, chooseExportFormat, t])- const selectedTrips = useMemo(() => trips.filter((t) => selected.has(t.index)), [trips, selected])+ const selectedTrips = useMemo(() => trips.filter((trip) => selected.has(trip.index)), [trips, selected])const canMerge = isAdjacentSelection(selected)const handleExportSelected = useCallback(async () => {if (selectedTrips.length === 0) return- const distance = selectedTrips.reduce((sum, t) => sum + t.distance, 0)+ const distance = selectedTrips.reduce((sum, trip) => sum + trip.distance, 0)const format = await chooseExportFormat(- selectedTrips.length === 1 ? `Export Trip ${selectedTrips[0].index}` : `Export ${selectedTrips.length} trips`,+ selectedTrips.length === 1+ ? t("history.exportTrip", { index: selectedTrips[0].index })+ : t("history.exportTrips", { count: selectedTrips.length, n: selectedTrips.length }),exportMessage(dayTitle(mapDate), selectedTrips.length, distance))if (format) await exportTrips(format, selectedTrips)- }, [selectedTrips, mapDate, exportTrips, chooseExportFormat])+ }, [selectedTrips, mapDate, exportTrips, chooseExportFormat, t])const handleMergeSelected = useCallback(async () => {if (editingTripsRef.current) returneditingTripsRef.current = truetry {if (!canMerge) {- showAlert("Merge trips", "Select two or more trips that follow each other.", "info")+ showAlert(t("history.merge.title"), t("history.merge.adjacent"), "info")return}const sorted = [...selectedTrips].sort((a, b) => a.index - b.index)const first = sorted[0].indexconst last = sorted[sorted.length - 1].indexconst confirmed = await showConfirm({- title: `Merge ${sorted.length} trips?`,- message: `${sorted.length === 2 ? `Trips ${first} and ${last}` : `Trips ${first}-${last}`} will be combined into one.`,- confirmText: "Merge"+ title: t("history.merge.confirmTitle", { count: sorted.length, n: sorted.length }),+ message: t(sorted.length === 2 ? "history.merge.confirmPair" : "history.merge.confirmRange", { first, last }),+ confirmText: t("history.merge.confirm")})if (!confirmed) return// Each displayed pair can span more than one gap: trips dropped by the extent filter still@@ -357,55 +365,57 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Loawait refreshAfterEdit()} catch (error) {logger.error("[LocationHistory] Trip merge failed:", error)- showAlert("Merge Failed", "Unable to merge the selected trips. Please try again.", "error")+ showAlert(t("history.merge.failed.title"), t("history.merge.failed.message"), "error")}} finally {editingTripsRef.current = false}- }, [canMerge, selectedTrips, trackLocations, boundaryOverrides, exitSelection, refreshAfterEdit])+ }, [canMerge, selectedTrips, trackLocations, boundaryOverrides, exitSelection, refreshAfterEdit, t])const handleDeleteSelected = useCallback(async () => {if (selectedTrips.length === 0 || editingTripsRef.current) returneditingTripsRef.current = truetry {- const totalPoints = selectedTrips.reduce((n, t) => n + t.locationCount, 0)+ const totalPoints = selectedTrips.reduce((n, trip) => n + trip.locationCount, 0)const confirmed = await showConfirm({title:selectedTrips.length === 1- ? `Delete Trip ${selectedTrips[0].index}?`- : `Delete ${selectedTrips.length} trips?`,- message: `Removes ${totalPoints} location point${- totalPoints === 1 ? "" : "s"- } from this device only. Already-synced points remain on your server. Unsent points will not be uploaded.`,- confirmText: "Delete",+ ? t("history.deleteTrip.title", { index: selectedTrips[0].index })+ : t("history.deleteTrips.title", { count: selectedTrips.length, n: selectedTrips.length }),+ message: t("history.deleteTrips.message", { count: totalPoints, n: totalPoints.toLocaleString() }),+ confirmText: t("common.delete"),destructive: true})if (!confirmed) returntry {await NativeLocationService.deleteLocationsInRanges(- selectedTrips.map((t) => ({ start: t.startTime, end: t.endTime }))+ selectedTrips.map((trip) => ({ start: trip.startTime, end: trip.endTime })))exitSelection()await refreshAfterEdit()} catch (error) {logger.error("[LocationHistory] Trip delete failed:", error)- showAlert("Delete Failed", "Unable to delete selection. Please try again.", "error")+ showAlert(t("history.delete.failed.title"), t("history.deleteTrips.failed"), "error")}} finally {editingTripsRef.current = false}- }, [selectedTrips, exitSelection, refreshAfterEdit])+ }, [selectedTrips, exitSelection, refreshAfterEdit, t])const handleMoreSelection = useCallback(async () => {const choice = await showChoice({- title: "Selection",- message: `${selected.size} of ${trips.length} trips selected`,+ title: t("history.selection.title"),+ message: t("history.selection.message", { count: trips.length, n: selected.size, total: trips.length }),variant: "info",- buttons: [{ text: "Select all" }, { text: "Clear selection" }, { text: "Cancel", style: "secondary" }]+ buttons: [+ { text: t("history.selection.all") },+ { text: t("history.selection.clear") },+ { text: t("common.cancel"), style: "secondary" }+ ]})- if (choice === 0) setSelected(new Set(trips.map((t) => t.index)))+ if (choice === 0) setSelected(new Set(trips.map((trip) => trip.index)))else if (choice === 1) exitSelection()- }, [selected.size, trips, exitSelection])+ }, [selected.size, trips, exitSelection, t])const toggleTrip = useCallback((index: number) => {setSelected((prev) => {@@ -420,10 +430,10 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo// The title carries the count, and a title change is silent for a screen reader.useEffect(() => {- if (selecting) AccessibilityInfo.announceForAccessibility(`${selected.size} selected`)- else if (wasSelectingRef.current) AccessibilityInfo.announceForAccessibility("Selection cleared")+ if (selecting) AccessibilityInfo.announceForAccessibility(t("history.selection.count", { n: selected.size }))+ else if (wasSelectingRef.current) AccessibilityInfo.announceForAccessibility(t("history.selection.cleared"))wasSelectingRef.current = selecting- }, [selecting, selected.size])+ }, [selecting, selected.size, t])useEffect(() => {if (!selecting) return@@ -435,8 +445,15 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo}, [selecting, exitSelection])const renderExitSelection = useCallback(- () => <HeaderAction icon={X} label="Exit selection" onPress={exitSelection} testID="exit-selection-btn" />,- [exitSelection]+ () => (+ <HeaderAction+ icon={X}+ label={t("history.action.exitSelection")}+ onPress={exitSelection}+ testID="exit-selection-btn"+ />+ ),+ [exitSelection, t])const renderSelectionActions = useCallback(@@ -444,15 +461,15 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo<View style={styles.headerRow}><HeaderActionicon={Upload}- label="Export selected trips"+ label={t("history.action.exportSelected")}onPress={handleExportSelected}testID="export-selected-btn"/>{selected.size > 1 && (<HeaderActionicon={Merge}- label="Merge trips"- hint={canMerge ? undefined : "Select two or more trips that follow each other"}+ label={t("history.merge.title")}+ hint={canMerge ? undefined : t("history.merge.adjacentHint")}color={canMerge ? colors.text : colors.textDisabled}onPress={handleMergeSelected}testID="merge-btn"@@ -460,15 +477,21 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo)}<HeaderActionicon={Trash2}- label="Delete trips"+ label={t("history.action.deleteTrips")}color={colors.error}onPress={handleDeleteSelected}testID="delete-trips-btn"/>- <HeaderAction icon={EllipsisVertical} label="More" onPress={handleMoreSelection} testID="more-btn" />+ <HeaderAction+ icon={EllipsisVertical}+ label={t("history.action.more")}+ onPress={handleMoreSelection}+ testID="more-btn"+ /></View>),[+ t,colors,canMerge,selected.size,@@ -482,26 +505,33 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Loconst renderDayActions = useCallback(() => (<View style={styles.headerRow}>- {!isToday && <HeaderAction icon={CalendarCheck} label="Go to today" onPress={goToToday} testID="today-btn" />}+ {!isToday && (+ <HeaderAction icon={CalendarCheck} label={t("history.action.today")} onPress={goToToday} testID="today-btn" />+ )}{trips.length > 0 && (- <HeaderAction icon={Upload} label="Export day" onPress={handleExportDay} testID="export-day-btn" />+ <HeaderAction+ icon={Upload}+ label={t("history.exportDay")}+ onPress={handleExportDay}+ testID="export-day-btn"+ />)}<HeaderActionicon={ChartNoAxesColumn}- label="Location summary"+ label={t("history.action.summary")}onPress={() => navigation.navigate("Location Summary")}testID="summary-btn"/></View>),- [isToday, trips.length, goToToday, handleExportDay, navigation]+ [isToday, trips.length, goToToday, handleExportDay, navigation, t])useLayoutEffect(() => {if (selecting) {navigation.setOptions({headerLeft: renderExitSelection,- headerTitle: `${selected.size} selected`,+ headerTitle: t("history.selection.count", { n: selected.size }),headerStyle: { backgroundColor: colors.card },headerRight: renderSelectionActions})@@ -509,11 +539,12 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo}navigation.setOptions({headerLeft: undefined,- headerTitle: SCREEN_TITLE,+ // setOptions cannot unset a key, so leaving selection writes the SCREEN_CONFIG title back.+ headerTitle: t("screen.locationHistory"),headerStyle: undefined,headerRight: renderDayActions})- }, [navigation, colors, selecting, selected.size, renderExitSelection, renderSelectionActions, renderDayActions])+ }, [navigation, colors, selecting, selected.size, renderExitSelection, renderSelectionActions, renderDayActions, t])const handlePointDelete = useCallback(async (id: number) => {@@ -521,10 +552,9 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Loconst point = trackLocations.find((l) => l.id === id)const at = point?.timestamp ? formatTime(point.timestamp, true) : nullconst confirmed = await showConfirm({- title: at ? `Delete the point at ${at}?` : "Delete Point?",- message:- "Removes this point from this device only. If it has already synced it stays on your server, and if it has not it will never be uploaded.",- confirmText: "Delete",+ title: at ? t("history.deletePoint.titleAt", { time: at }) : t("history.deletePoint.title"),+ message: t("history.deletePoint.message"),+ confirmText: t("common.delete"),destructive: true})if (!confirmed) return@@ -534,23 +564,26 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Loawait refreshAfterEdit()} catch (error) {logger.error("[LocationHistory] Point delete failed:", error)- showAlert("Delete Failed", "Unable to delete point. Please try again.", "error")+ showAlert(t("history.delete.failed.title"), t("history.deletePoint.failed"), "error")} finally {deletingPointRef.current = false}},- [trackLocations, refreshAfterEdit]+ [trackLocations, refreshAfterEdit, t])- const handlePointNoteChange = useCallback(async (id: number, note: string | null) => {- try {- await NativeLocationService.updateLocationNote(id, note)- setNoteOverrides((prev) => ({ ...prev, [id]: note ?? undefined }))- } catch (error) {- logger.error("[LocationHistory] Note update failed:", error)- showAlert("Save Failed", "Unable to save note. Please try again.", "error")- }- }, [])+ const handlePointNoteChange = useCallback(+ async (id: number, note: string | null) => {+ try {+ await NativeLocationService.updateLocationNote(id, note)+ setNoteOverrides((prev) => ({ ...prev, [id]: note ?? undefined }))+ } catch (error) {+ logger.error("[LocationHistory] Note update failed:", error)+ showAlert(t("history.note.failed.title"), t("history.note.failed.message"), "error")+ }+ },+ [t]+ )const focusTripFromDock = useCallback((index: number | null) => {setFocusedTripIndex(index)@@ -585,15 +618,15 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Loempty.action === "lastDay" && lastDay? {icon: RotateCcwClock,- label: "Last day with data",+ label: t("history.lastDay"),sub: lastDaySub(lastDay),onPress: () => changeDay(dateFromKey(lastDay.day))}: empty.action === "dashboard"? {icon: CirclePause,- label: "Open Dashboard",- sub: "Tracking is off",+ label: t("history.openDashboard"),+ sub: t("history.trackingOff"),onPress: () => navigation.navigate("Dashboard")}: undefined@@ -654,9 +687,24 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo/><View style={[styles.tabBar, { backgroundColor: colors.background }]}>- <Tab label="Map" active={activeTab === "map"} onPress={() => changeTab("map")} colors={colors} />- <Tab label="Trips" active={activeTab === "trips"} onPress={() => changeTab("trips")} colors={colors} />- <Tab label="Data" active={activeTab === "data"} onPress={() => changeTab("data")} colors={colors} />+ <Tab+ label={t("history.tab.map")}+ active={activeTab === "map"}+ onPress={() => changeTab("map")}+ colors={colors}+ />+ <Tab+ label={t("history.tab.trips")}+ active={activeTab === "trips"}+ onPress={() => changeTab("trips")}+ colors={colors}+ />+ <Tab+ label={t("history.tab.data")}+ active={activeTab === "data"}+ onPress={() => changeTab("data")}+ colors={colors}+ /></View><Divider tight />@@ -700,9 +748,12 @@ export function LocationHistoryScreen({ navigation, route }: RootScreenProps<"Lo) : trips.length === 0 ? (<EmptyStateicon={Route}- title="No trips"- hint={`${trackLocations.length} points were recorded but none spread more than 100 m`}- action={{ label: "Show points", onPress: () => changeTab("data") }}+ title={t("history.noTrips.title")}+ hint={t("history.noTrips.hint", {+ count: trackLocations.length,+ n: trackLocations.length.toLocaleString()+ })}+ action={{ label: t("history.noTrips.show"), onPress: () => changeTab("data") }}/>) : (<TripListdiff --git a/apps/mobile/src/screens/__tests__/LocationInspectorScreen.test.tsx b/apps/mobile/src/screens/__tests__/LocationInspectorScreen.test.tsxindex 7160611d..6fd774c8 100644--- a/apps/mobile/src/screens/__tests__/LocationInspectorScreen.test.tsx+++ b/apps/mobile/src/screens/__tests__/LocationInspectorScreen.test.tsx@@ -463,6 +463,15 @@ describe("lenses", () => {expect(getByTestId("LocationTable")).toBeTruthy()})+ it("says a single point was recorded in the singular", async () => {+ withDay(DAY_POINTS.slice(0, 1), [])+ const { getByText, getByTestId } = render(<LocationHistoryScreen {...createProps()} />)+ await settled(getByTestId)++ fireEvent.press(getByText("Trips"))+ expect(getByText("1 point was recorded but none spread more than 100 m")).toBeTruthy()+ })+it("changing day drops the selected point and the focused trip", async () => {withDay()const { getByTestId } = render(<LocationHistoryScreen {...createProps()} />)@@ -686,6 +695,24 @@ describe("selection", () => {await waitFor(() => expect(lastOptions(props).headerTitle).toBe("Location history"))})+ it("counts the points a trip delete removes, in the singular for one", async () => {+ withDay()+ ;(showConfirm as jest.Mock).mockResolvedValueOnce(false)+ const props = createProps()+ await selectTrips(props, [3])++ fireEvent.press(headerRight(props).getByLabelText("Delete trips"))++ await waitFor(() =>+ expect(showConfirm).toHaveBeenCalledWith(+ expect.objectContaining({+ title: "Delete Trip 3?",+ message: expect.stringMatching(/^Removes 1 location point from/)+ })+ )+ )+ })+it("keeps the selection when a delete fails, so the user can retry", async () => {withDay();(showConfirm as jest.Mock).mockResolvedValueOnce(true)diff --git a/apps/mobile/src/utils/inspectorDay.ts b/apps/mobile/src/utils/inspectorDay.tsindex 20776281..30c686c3 100644--- a/apps/mobile/src/utils/inspectorDay.ts+++ b/apps/mobile/src/utils/inspectorDay.ts@@ -6,6 +6,7 @@import type { DailyStat } from "../types/global"import { formatDistance } from "./geo"import { pad2 } from "./format"+import { t } from "../i18n/t"export type MonthData = {days: ReadonlySet<string>@@ -63,15 +64,14 @@ export async function findLastDayWithData(return null}-function count(n: number, noun: string): string {- return `${n} ${noun}${n === 1 ? "" : "s"}`-}+const points = (n: number) => t("history.points", { count: n, n: n.toLocaleString() })+const trips = (n: number) => t("history.trips", { count: n, n })export function lastDaySub({ day, stat }: LastDay): string {const date = dateFromKey(day).toLocaleDateString(undefined, { weekday: "short", month: "short", day: "numeric" })if (!stat) return date- if (stat.tripCount === 0) return `${date} · ${count(stat.count, "point")}`- return `${date} · ${count(stat.tripCount, "trip")} · ${formatDistance(stat.distanceMeters)}`+ if (stat.tripCount === 0) return `${date} · ${points(stat.count)}`+ return `${date} · ${trips(stat.tripCount)} · ${formatDistance(stat.distanceMeters)}`}export type EmptyDayAction = "lastDay" | "dashboard"@@ -89,23 +89,27 @@ export function emptyDayVariant(input: {hasLastDay: boolean}): EmptyDayVariant {if (!input.isToday) {- return { title: "Nothing recorded", hint: input.longDate, action: input.hasLastDay ? "lastDay" : null }+ return {+ title: t("history.empty.nothingRecorded"),+ hint: input.longDate,+ action: input.hasLastDay ? "lastDay" : null+ }}if (input.tracking) {- return { title: "No locations yet", hint: "Tracking is on. The first fix lands here.", action: null }+ return { title: t("history.empty.noLocationsYet"), hint: t("history.empty.noLocationsYet.hint"), action: null }}if (input.hasLastDay) {- return { title: "No locations today", hint: "Tracking is off.", action: "dashboard" }+ return { title: t("history.empty.noLocationsToday"), hint: t("history.empty.trackingOff"), action: "dashboard" }}return {- title: "Nothing recorded yet",- hint: "Start tracking on the Dashboard and today's track appears here.",+ title: t("history.empty.nothingYet"),+ hint: t("history.empty.nothingYet.hint"),action: "dashboard"}}export function exportMessage(dateLabel: string, tripCount: number, distanceMeters: number): string {- return `${dateLabel} · ${count(tripCount, "trip")} · ${formatDistance(distanceMeters)}`+ return `${dateLabel} · ${trips(tripCount)} · ${formatDistance(distanceMeters)}`}export function isAdjacentSelection(indices: Iterable<number>): boolean {