From ac53e9c9f1f993630720d101b61a624239d78569 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 29 Aug 2022 09:26:02 -0600 Subject: [PATCH] Translate camera --- web/public/locales/en/translation.json | 13 ++++++++++++- web/src/routes/Camera.jsx | 22 ++++++++++++---------- web/src/routes/CameraMap.jsx | 2 +- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index b6124489e..01867bfc9 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -8,6 +8,7 @@ "auto_dark_mode": "Auto Dark Mode", "best_image": "Best Image", "birdseye": "Birdseye", + "bounding_box": "Bounding Box", "_camera": "camera", "camera": "Camera", "cameras": "Cameras", @@ -32,28 +33,38 @@ "download_snapshot": "Download Snapshot", "events": "Events", "github": "GitHub", + "hide": "Hide", "in_progress": "In Progress", "last_month": "Last Month", "last_seven_days": "Last Seven Days", "light": "Light", + "live": "Live", + "masks": "Masks", + "motion_boxes": "Motion Boxes", "motion_masks": "Motion Masks", "object_masks": "Object Masks", + "options": "Options", "recordings": "Recordings", + "regions": "Regions", "remove": "Remove", "restart_frigate": "Restart Frigate", "restart_in_progress": "Restart in progress", "send_to_frigate_plus": "Send To Frigate+", "sent_to_frigate_plus": "Sent To Frigate+", + "show": "Show", "style_guide": "Style Guide", "this_month": "This Month", "thumbnail": "Thumbnail", + "timestamp": "Timestamp", "title_delete_saved_event": "Delete Saved Event?", - "title_mask_creation": "{camera} Mask & Zone Creator", + "title_mask_creation": "Mask & Zone Creator", + "title_mask_creation_camera": "{camera} Mask & Zone Creator", "title_no_recordings": "No Recordings Found", "today": "Today", "toggle_detect": "Toggle Detect", "toggle_recordings": "Toggle Recordings", "toggle_snapshots": "Toggle Snapshots", + "tracked_objects": "Tracked Objects", "uploading": "Uploading...", "wait_for_restart": "Please wait a few seconds for the restart to complete before reloading the page.", "warning": "Warning", diff --git a/web/src/routes/Camera.jsx b/web/src/routes/Camera.jsx index ec3bc7038..a38782eeb 100644 --- a/web/src/routes/Camera.jsx +++ b/web/src/routes/Camera.jsx @@ -13,10 +13,12 @@ import { usePersistence } from '../context'; import { useCallback, useMemo, useState } from 'preact/hooks'; import { useApiHost } from '../api'; import useSWR from 'swr'; +import { useTranslation } from 'react-i18next'; const emptyObject = Object.freeze({}); export default function Camera({ camera }) { + const { t } = useTranslation(); const { data: config } = useSWR('config'); const apiHost = useApiHost(); const [showSettings, setShowSettings] = useState(false); @@ -61,33 +63,33 @@ export default function Camera({ camera }) { checked={options['bbox']} id="bbox" onChange={handleSetOption} - label="Bounding box" + label={t('bounding_box')} labelPosition="after" /> - - + + - Mask & Zone creator + {t('title_mask_creation')} ) : null; @@ -111,9 +113,9 @@ export default function Camera({ camera }) { {' '} - {showSettings ? 'Hide' : 'Show'} Options + {showSettings ? t('hide') : t('show')} {t('options')} - {showSettings ? : null} + {showSettings ? : null} ); } @@ -126,7 +128,7 @@ export default function Camera({ camera }) { {player}
- Tracked objects + {t('tracked_objects')}
{cameraConfig.objects.track.map((objectType) => ( - {t('title_mask_creation') + {t('title_mask_creation_camera') .replace("{camera}", camera.replace("_", " ")) }