@@ -53,7 +55,7 @@ export default function EntryLogs({
- {new Date(entryLogs[0].createdAt).toLocaleString()}
+ {new Date(entryLogs[0].createdAt).toLocaleString(i18n.language)}
@@ -68,7 +70,7 @@ export default function EntryLogs({
- Show all logs.
+ {t('show_all_logs')}
@@ -76,13 +78,10 @@ export default function EntryLogs({
- Device Logs
-
- If this is your device, you can make changes in your device
- settings.
-
+ {t('device_logs')}
+ {t('logs_owner_hint')}
-
+
-
Logs
+
{t('logs')}
@@ -103,7 +102,7 @@ export default function EntryLogs({
{entryLogs[0].content}
- {new Date(entryLogs[0].createdAt).toLocaleString()}
+ {new Date(entryLogs[0].createdAt).toLocaleString(i18n.language)}
@@ -116,16 +115,13 @@ export default function EntryLogs({
- Device Logs
-
- If this is your device, you can make changes in your device
- settings.
-
+ {t('device_logs')}
+ {t('logs_owner_hint')}
-
+
- Close
+ {t('close')}
@@ -135,9 +131,15 @@ export default function EntryLogs({
)
}
-function LogList({ entryLogs = [] }: { entryLogs: LogEntry[] }) {
+function LogList({
+ entryLogs = [],
+ locale,
+}: {
+ entryLogs: LogEntry[]
+ locale: string
+}) {
return (
-
+
{entryLogs.map((log, index) => (
@@ -149,7 +151,7 @@ function LogList({ entryLogs = [] }: { entryLogs: LogEntry[] }) {
{log.content}
- {new Date(log.createdAt).toLocaleString()}
+ {new Date(log.createdAt).toLocaleString(locale)}
diff --git a/app/components/device-detail/share-link.tsx b/app/components/device-detail/share-link.tsx
index 9c61e9fc..5d3d22fd 100644
--- a/app/components/device-detail/share-link.tsx
+++ b/app/components/device-detail/share-link.tsx
@@ -1,10 +1,12 @@
import { Copy, Link } from 'lucide-react'
+import { useTranslation } from 'react-i18next'
import { Button } from '../ui/button'
import { Input } from '../ui/input'
import { useToast } from '@/components/ui/use-toast'
export default function ShareLink() {
const { toast } = useToast()
+ const { t } = useTranslation('device-detail-box')
return (
@@ -84,14 +86,14 @@ export default function ShareLink() {
onClick={() => {
void navigator.clipboard.writeText(window.location.href)
toast({
- title: 'Copied to clipboard',
- description: 'Go ahead and share your link! đ',
+ title: t('copied_to_clipboard'),
+ description: t('share_link_hint'),
})
}}
className="bg-primary text-primary-foreground inline-flex h-9 transform items-center justify-center rounded-md px-2 py-2 text-sm font-medium shadow-sm transition-transform active:scale-75"
>
- Copy
+ {t('copy')}
diff --git a/app/components/mydevices/dt/columns.tsx b/app/components/mydevices/dt/columns.tsx
index ac3f88aa..f3978eb5 100644
--- a/app/components/mydevices/dt/columns.tsx
+++ b/app/components/mydevices/dt/columns.tsx
@@ -107,6 +107,10 @@ export function getColumns(
)
},
+ cell: ({ row }) => {
+ const exposure = row.original.exposure
+ return {t(`exposure_values.${exposure}`)}
+ },
},
/* {
accessorKey: "model",
diff --git a/app/components/rjsf/arrayFieldTemplate.tsx b/app/components/rjsf/arrayFieldTemplate.tsx
index 0a90f453..f0d0be80 100644
--- a/app/components/rjsf/arrayFieldTemplate.tsx
+++ b/app/components/rjsf/arrayFieldTemplate.tsx
@@ -1,9 +1,11 @@
import { type ArrayFieldTemplateProps } from '@rjsf/utils'
import React from 'react'
+import { useTranslation } from 'react-i18next'
import { Button } from '~/components/ui/button'
import { Card, CardContent } from '~/components/ui/card'
export function ArrayFieldTemplate(props: ArrayFieldTemplateProps) {
+ const { t } = useTranslation('ui-components')
const { items, canAdd, onAddClick } = props
const renderedItems = React.Children.toArray(items)
@@ -18,7 +20,7 @@ export function ArrayFieldTemplate(props: ArrayFieldTemplateProps) {
{canAdd && (
- Add item
+ {t('array_field.add_item')}
)}
diff --git a/app/routes/device.$deviceId.edit.logs.tsx b/app/routes/device.$deviceId.edit.logs.tsx
index 662c78e2..03a32f13 100644
--- a/app/routes/device.$deviceId.edit.logs.tsx
+++ b/app/routes/device.$deviceId.edit.logs.tsx
@@ -1,5 +1,6 @@
import { Save, Trash } from 'lucide-react'
import { useEffect, useState } from 'react'
+import { useTranslation } from 'react-i18next'
import {
data,
redirect,
@@ -60,7 +61,7 @@ export async function action({ request, params }: Route.ActionArgs) {
await createLogEntry({ deviceId: deviceID, content, public: false })
return data({
success: true,
- message: 'Log added successfully!',
+ message: 'log_added',
})
}
case 'deleteLog': {
@@ -68,7 +69,7 @@ export async function action({ request, params }: Route.ActionArgs) {
await deleteLogEntry(logEntryId)
return data({
success: true,
- message: 'Log deleted successfully!',
+ message: 'log_deleted',
})
}
case 'togglePublic': {
@@ -77,18 +78,15 @@ export async function action({ request, params }: Route.ActionArgs) {
await updateLogEntryVisibility(logEntryId, isPublic === 'true')
return data({
success: true,
- message: 'Log visibility updated!',
+ message: 'visibility_updated',
})
}
default:
- return data({ success: false, message: 'Unknown action.' })
+ return data({ success: false, message: 'unknown_action' })
}
} catch (error) {
console.error('Error processing action:', error)
- return data(
- { success: false, message: 'Something went wrong.' },
- { status: 500 },
- )
+ return data({ success: false, message: 'error' }, { status: 500 })
}
}
@@ -96,6 +94,7 @@ export default function Logs() {
const { logEntries } = useLoaderData
()
const actionData = useActionData()
const { toast } = useToast()
+ const { t } = useTranslation('edit-device-logs')
const [newLogContent, setNewLogContent] = useState('')
const submit = useSubmit()
@@ -105,17 +104,17 @@ export default function Logs() {
if (actionData) {
if (actionData.success) {
toast({
- title: actionData.message,
+ title: t(actionData.message),
variant: 'success',
})
} else {
toast({
- title: actionData.message,
+ title: t(actionData.message),
variant: 'destructive',
})
}
}
- }, [actionData, toast])
+ }, [actionData, t, toast])
return (
@@ -127,7 +126,7 @@ export default function Logs() {
{/* Title */}
-
Device Logs
+ {t('title')}
@@ -138,7 +137,7 @@ export default function Logs() {
setNewLogContent(e.target.value)}
@@ -159,10 +158,10 @@ export default function Logs() {
- Content
- Created At
- Public
- Actions
+ {t('content')}
+ {t('created_at')}
+ {t('public')}
+ {t('actions')}
diff --git a/app/routes/device.$deviceId.edit.tsx b/app/routes/device.$deviceId.edit.tsx
index 30a44490..b34804c9 100644
--- a/app/routes/device.$deviceId.edit.tsx
+++ b/app/routes/device.$deviceId.edit.tsx
@@ -48,21 +48,33 @@ export default function EditBox() {
const { deviceId } = useParams()
const staticNavItems = [
- { title: 'General', href: `/device/${deviceId}/edit/general`, icon: Sheet },
- { title: 'Sensors', href: `/device/${deviceId}/edit/sensors`, icon: Cpu },
{
- title: 'Location',
+ title: t('sidebar.general'),
+ href: `/device/${deviceId}/edit/general`,
+ icon: Sheet,
+ },
+ {
+ title: t('sidebar.sensors'),
+ href: `/device/${deviceId}/edit/sensors`,
+ icon: Cpu,
+ },
+ {
+ title: t('sidebar.location'),
href: `/device/${deviceId}/edit/location`,
icon: MapPin,
},
- { title: 'Logs', href: `/device/${deviceId}/edit/logs`, icon: NotepadText },
{
- title: 'Security',
+ title: t('sidebar.logs'),
+ href: `/device/${deviceId}/edit/logs`,
+ icon: NotepadText,
+ },
+ {
+ title: t('sidebar.security'),
href: `/device/${deviceId}/edit/security`,
icon: Lock,
},
{
- title: 'Script',
+ title: t('sidebar.script'),
href: `/device/${deviceId}/edit/script`,
icon: FileText,
},
@@ -82,7 +94,7 @@ export default function EditBox() {
...staticNavItems,
...integrationItems,
{
- title: 'Transfer',
+ title: t('sidebar.transfer'),
href: `/device/${deviceId}/edit/transfer`,
icon: ArrowRightLeft,
},
diff --git a/public/locales/de/data-table.json b/public/locales/de/data-table.json
index abbacb3f..45d96aaa 100644
--- a/public/locales/de/data-table.json
+++ b/public/locales/de/data-table.json
@@ -13,7 +13,13 @@
"actions": "Aktionen",
"name": "Name",
"createdAt": "Erstellt am",
- "exposure": "Exposition",
+ "exposure": "Standort",
+ "exposure_values": {
+ "indoor": "Drinnen",
+ "outdoor": "DrauĂen",
+ "mobile": "Mobil",
+ "unknown": "Unbekannt"
+ },
"model": "Modell",
"overview": "Ăberblick",
"show_on_map": "Auf der Karte anzeigen",
diff --git a/public/locales/de/device-detail-box.json b/public/locales/de/device-detail-box.json
index 98c1ea89..d10bb808 100644
--- a/public/locales/de/device-detail-box.json
+++ b/public/locales/de/device-detail-box.json
@@ -12,5 +12,28 @@
"sensor_order_hint_link": "Sensoreinstellungen",
"compare_devices": "GerÀte vergleichen",
"choose_device_for_comparison": "WĂ€hle ein GerĂ€t auf der Karte fĂŒr den Vergleich.",
- "open_device_details": "Ăffne GerĂ€tedetails"
+ "open_device_details": "GerÀtedetails öffnen",
+ "device_image": "GerÀtebild",
+ "exposure": "Standort",
+ "exposure_values": {
+ "indoor": "Drinnen",
+ "outdoor": "DrauĂen",
+ "mobile": "Mobil"
+ },
+ "unknown": "Unbekannt",
+ "sensor_model": "Sensormodell",
+ "last_updated": "Zuletzt aktualisiert",
+ "created_at": "Erstellt am",
+ "expires_at": "LĂ€uft ab am",
+ "tags": "Tags",
+ "sensor_limit_title": "Es können höchstens zwei Sensoren ausgewÀhlt werden",
+ "sensor_limit_description": "Hebe die Auswahl eines Sensors auf, um einen anderen auszuwÀhlen",
+ "no_recent_data": "Keine aktuellen Daten",
+ "logs": "Protokoll",
+ "show_all_logs": "Alle ProtokolleintrÀge anzeigen.",
+ "device_logs": "GerÀteprotokoll",
+ "logs_owner_hint": "Wenn dies dein GerĂ€t ist, kannst du Ănderungen in den GerĂ€teeinstellungen vornehmen.",
+ "copied_to_clipboard": "In die Zwischenablage kopiert",
+ "share_link_hint": "Jetzt kannst du deinen Link teilen! đ",
+ "copy": "Kopieren"
}
diff --git a/public/locales/de/device-overview.json b/public/locales/de/device-overview.json
index f7f24944..e4cb3101 100644
--- a/public/locales/de/device-overview.json
+++ b/public/locales/de/device-overview.json
@@ -13,6 +13,15 @@
"api_key_label": "API Key",
"device_settings": "GerÀtseinstellungen",
"manage_device_data": "Verwalte die Daten deines GerÀts.",
+ "sidebar": {
+ "general": "Allgemein",
+ "sensors": "Sensoren",
+ "location": "Standort",
+ "logs": "Protokolle",
+ "security": "Sicherheit",
+ "script": "Skript",
+ "transfer": "Ăbertragen"
+ },
"show_on_map": "Auf der Karte anzeigen",
"device_updated": "GerÀt erfolgreich aktualisiert",
"view": "Ansicht"
diff --git a/public/locales/de/edit-device-logs.json b/public/locales/de/edit-device-logs.json
new file mode 100644
index 00000000..f06a5290
--- /dev/null
+++ b/public/locales/de/edit-device-logs.json
@@ -0,0 +1,13 @@
+{
+ "title": "GerÀteprotokoll",
+ "content_placeholder": "Protokolleintrag eingeben",
+ "content": "Inhalt",
+ "created_at": "Erstellt am",
+ "public": "Ăffentlich",
+ "actions": "Aktionen",
+ "log_added": "Protokolleintrag erfolgreich hinzugefĂŒgt!",
+ "log_deleted": "Protokolleintrag erfolgreich gelöscht!",
+ "visibility_updated": "Sichtbarkeit des Protokolleintrags aktualisiert!",
+ "unknown_action": "Unbekannte Aktion.",
+ "error": "Etwas ist schiefgelaufen."
+}
diff --git a/public/locales/de/ui-components.json b/public/locales/de/ui-components.json
index 10f57331..3cd4f883 100644
--- a/public/locales/de/ui-components.json
+++ b/public/locales/de/ui-components.json
@@ -5,5 +5,8 @@
"callout_title_important": "Wichtig",
"callout_title_warning": "Warnung",
"callout_title_caution": "Achtung"
+ },
+ "array_field": {
+ "add_item": "Eintrag hinzufĂŒgen"
}
}
diff --git a/public/locales/en/data-table.json b/public/locales/en/data-table.json
index 116ed671..9bae7e98 100644
--- a/public/locales/en/data-table.json
+++ b/public/locales/en/data-table.json
@@ -14,6 +14,12 @@
"name": "Name",
"createdAt": "Created at",
"exposure": "Exposure",
+ "exposure_values": {
+ "indoor": "Indoor",
+ "outdoor": "Outdoor",
+ "mobile": "Mobile",
+ "unknown": "Unknown"
+ },
"model": "Model",
"overview": "Overview",
"show_on_map": "Show on map",
diff --git a/public/locales/en/device-detail-box.json b/public/locales/en/device-detail-box.json
index 4214e94d..2c7f4fe2 100644
--- a/public/locales/en/device-detail-box.json
+++ b/public/locales/en/device-detail-box.json
@@ -12,5 +12,28 @@
"sensor_order_hint_link": "sensor settings",
"compare_devices": "Compare devices",
"choose_device_for_comparison": "Choose a device on the map to compare with.",
- "open_device_details": "Open device details"
+ "open_device_details": "Open device details",
+ "device_image": "Device image",
+ "exposure": "Exposure",
+ "exposure_values": {
+ "indoor": "Indoor",
+ "outdoor": "Outdoor",
+ "mobile": "Mobile"
+ },
+ "unknown": "Unknown",
+ "sensor_model": "Sensor model",
+ "last_updated": "Last updated",
+ "created_at": "Created at",
+ "expires_at": "Expires at",
+ "tags": "Tags",
+ "sensor_limit_title": "Can't select more than 2 sensors",
+ "sensor_limit_description": "Deselect one sensor to select another",
+ "no_recent_data": "No recent data",
+ "logs": "Logs",
+ "show_all_logs": "Show all logs.",
+ "device_logs": "Device logs",
+ "logs_owner_hint": "If this is your device, you can make changes in your device settings.",
+ "copied_to_clipboard": "Copied to clipboard",
+ "share_link_hint": "Go ahead and share your link! đ",
+ "copy": "Copy"
}
diff --git a/public/locales/en/device-overview.json b/public/locales/en/device-overview.json
index d30d8872..239443e2 100644
--- a/public/locales/en/device-overview.json
+++ b/public/locales/en/device-overview.json
@@ -13,6 +13,15 @@
"api_key_label": "API Key",
"device_settings": "Device settings",
"manage_device_data": "Manage your device data.",
+ "sidebar": {
+ "general": "General",
+ "sensors": "Sensors",
+ "location": "Location",
+ "logs": "Logs",
+ "security": "Security",
+ "script": "Script",
+ "transfer": "Transfer"
+ },
"show_on_map": "Show on map",
"device_updated": "Device successfully updated",
"view": "View"
diff --git a/public/locales/en/edit-device-logs.json b/public/locales/en/edit-device-logs.json
new file mode 100644
index 00000000..b0c526bb
--- /dev/null
+++ b/public/locales/en/edit-device-logs.json
@@ -0,0 +1,13 @@
+{
+ "title": "Device Logs",
+ "content_placeholder": "Enter log content",
+ "content": "Content",
+ "created_at": "Created at",
+ "public": "Public",
+ "actions": "Actions",
+ "log_added": "Log added successfully!",
+ "log_deleted": "Log deleted successfully!",
+ "visibility_updated": "Log visibility updated!",
+ "unknown_action": "Unknown action.",
+ "error": "Something went wrong."
+}
diff --git a/public/locales/en/ui-components.json b/public/locales/en/ui-components.json
index 2177d5bb..c1175788 100644
--- a/public/locales/en/ui-components.json
+++ b/public/locales/en/ui-components.json
@@ -5,5 +5,8 @@
"callout_title_important": "Important",
"callout_title_warning": "Warning",
"callout_title_caution": "Caution"
+ },
+ "array_field": {
+ "add_item": "Add item"
}
}