From 907b3752e14a4e4571aa345b7c8ee12f9844f9eb Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sat, 27 Aug 2022 11:12:31 -0600 Subject: [PATCH] Add debug tranlsations --- web/public/locales/en/translation.json | 8 +++++++- web/src/routes/Debug.jsx | 14 ++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index a6ba93d44..c80b474a9 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -2,23 +2,29 @@ "all": "All", "all_cameras": "All Cameras", "all_labels": "All Labels", - "all_sub_labels": "All Sub Labels" + "all_sub_labels": "All Sub Labels", "all_zones": "All Zones", "are_you_sure": "Are you sure?", "auto_dark_mode": "Auto Dark Mode", "best_image": "Best Image", "birdseye": "Birdseye", + "_camera": "camera", + "camera": "Camera", "cameras": "Cameras", "cancel": "Cancel", "clip": "Clip", "close": "Close", "_confidence": "confidence", + "config": "Config", + "copy_clipboard": "Copy To Clipboard", "custom_range": "Custom Range", "dark": "Dark", "debug": "Debug", + "debug_update_interval": "Debug stats update automatically every {interval} seconds.", "delete": "Delete", "desc_delete_saved_event": "Confirm deletion of saved event.", "desc_no_recordings": "Make sure you have enabled the record role in your configuration for the {camera} camera.", + "_detector": "detector", "documentation": "Documentation", "download_clip": "Download Clip", "download_snapshot": "Download Snapshot", diff --git a/web/src/routes/Debug.jsx b/web/src/routes/Debug.jsx index b404c61a9..b5b6a75b1 100644 --- a/web/src/routes/Debug.jsx +++ b/web/src/routes/Debug.jsx @@ -7,10 +7,12 @@ import { useMqtt } from '../api/mqtt'; import useSWR from 'swr'; import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table'; import { useCallback } from 'preact/hooks'; +import { useTranslation } from 'react-i18next'; const emptyObject = Object.freeze({}); export default function Debug() { + const { t } = useTranslation(); const { data: config } = useSWR('config'); const { @@ -35,7 +37,7 @@ export default function Debug() { return (
- Debug {service.version} + {t('debug')} {service.version} {!detectors ? ( @@ -48,7 +50,7 @@ export default function Debug() { - + {detectorDataKeys.map((name) => ( ))} @@ -71,7 +73,7 @@ export default function Debug() {
detector{t('_detector')}{name.replace('_', ' ')}
- + {cameraDataKeys.map((name) => ( ))} @@ -92,14 +94,14 @@ export default function Debug() {
camera{t('_camera')}{name.replace('_', ' ')}
-

Debug stats update automatically every {config.mqtt.stats_interval} seconds.

+

{t('debug_update_interval').replace("{interval}", config.mqtt.stats_interval)}

)}
- Config + {t('config')}
           {JSON.stringify(config, null, 2)}