Translate camera

This commit is contained in:
Nick Mowen 2022-08-29 09:26:02 -06:00
parent 806da66aa4
commit ac53e9c9f1
3 changed files with 25 additions and 12 deletions

View File

@ -8,6 +8,7 @@
"auto_dark_mode": "Auto Dark Mode", "auto_dark_mode": "Auto Dark Mode",
"best_image": "Best Image", "best_image": "Best Image",
"birdseye": "Birdseye", "birdseye": "Birdseye",
"bounding_box": "Bounding Box",
"_camera": "camera", "_camera": "camera",
"camera": "Camera", "camera": "Camera",
"cameras": "Cameras", "cameras": "Cameras",
@ -32,28 +33,38 @@
"download_snapshot": "Download Snapshot", "download_snapshot": "Download Snapshot",
"events": "Events", "events": "Events",
"github": "GitHub", "github": "GitHub",
"hide": "Hide",
"in_progress": "In Progress", "in_progress": "In Progress",
"last_month": "Last Month", "last_month": "Last Month",
"last_seven_days": "Last Seven Days", "last_seven_days": "Last Seven Days",
"light": "Light", "light": "Light",
"live": "Live",
"masks": "Masks",
"motion_boxes": "Motion Boxes",
"motion_masks": "Motion Masks", "motion_masks": "Motion Masks",
"object_masks": "Object Masks", "object_masks": "Object Masks",
"options": "Options",
"recordings": "Recordings", "recordings": "Recordings",
"regions": "Regions",
"remove": "Remove", "remove": "Remove",
"restart_frigate": "Restart Frigate", "restart_frigate": "Restart Frigate",
"restart_in_progress": "Restart in progress", "restart_in_progress": "Restart in progress",
"send_to_frigate_plus": "Send To Frigate+", "send_to_frigate_plus": "Send To Frigate+",
"sent_to_frigate_plus": "Sent To Frigate+", "sent_to_frigate_plus": "Sent To Frigate+",
"show": "Show",
"style_guide": "Style Guide", "style_guide": "Style Guide",
"this_month": "This Month", "this_month": "This Month",
"thumbnail": "Thumbnail", "thumbnail": "Thumbnail",
"timestamp": "Timestamp",
"title_delete_saved_event": "Delete Saved Event?", "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", "title_no_recordings": "No Recordings Found",
"today": "Today", "today": "Today",
"toggle_detect": "Toggle Detect", "toggle_detect": "Toggle Detect",
"toggle_recordings": "Toggle Recordings", "toggle_recordings": "Toggle Recordings",
"toggle_snapshots": "Toggle Snapshots", "toggle_snapshots": "Toggle Snapshots",
"tracked_objects": "Tracked Objects",
"uploading": "Uploading...", "uploading": "Uploading...",
"wait_for_restart": "Please wait a few seconds for the restart to complete before reloading the page.", "wait_for_restart": "Please wait a few seconds for the restart to complete before reloading the page.",
"warning": "Warning", "warning": "Warning",

View File

@ -13,10 +13,12 @@ import { usePersistence } from '../context';
import { useCallback, useMemo, useState } from 'preact/hooks'; import { useCallback, useMemo, useState } from 'preact/hooks';
import { useApiHost } from '../api'; import { useApiHost } from '../api';
import useSWR from 'swr'; import useSWR from 'swr';
import { useTranslation } from 'react-i18next';
const emptyObject = Object.freeze({}); const emptyObject = Object.freeze({});
export default function Camera({ camera }) { export default function Camera({ camera }) {
const { t } = useTranslation();
const { data: config } = useSWR('config'); const { data: config } = useSWR('config');
const apiHost = useApiHost(); const apiHost = useApiHost();
const [showSettings, setShowSettings] = useState(false); const [showSettings, setShowSettings] = useState(false);
@ -61,33 +63,33 @@ export default function Camera({ camera }) {
checked={options['bbox']} checked={options['bbox']}
id="bbox" id="bbox"
onChange={handleSetOption} onChange={handleSetOption}
label="Bounding box" label={t('bounding_box')}
labelPosition="after" labelPosition="after"
/> />
<Switch <Switch
checked={options['timestamp']} checked={options['timestamp']}
id="timestamp" id="timestamp"
onChange={handleSetOption} onChange={handleSetOption}
label="Timestamp" label={t('timestamp')}
labelPosition="after" labelPosition="after"
/> />
<Switch checked={options['zones']} id="zones" onChange={handleSetOption} label="Zones" labelPosition="after" /> <Switch checked={options['zones']} id="zones" onChange={handleSetOption} label={t('zones')} labelPosition="after" />
<Switch checked={options['mask']} id="mask" onChange={handleSetOption} label="Masks" labelPosition="after" /> <Switch checked={options['mask']} id="mask" onChange={handleSetOption} label={t('masks')} labelPosition="after" />
<Switch <Switch
checked={options['motion']} checked={options['motion']}
id="motion" id="motion"
onChange={handleSetOption} onChange={handleSetOption}
label="Motion boxes" label={t('motion_boxes')}
labelPosition="after" labelPosition="after"
/> />
<Switch <Switch
checked={options['regions']} checked={options['regions']}
id="regions" id="regions"
onChange={handleSetOption} onChange={handleSetOption}
label="Regions" label={t('regions')}
labelPosition="after" labelPosition="after"
/> />
<Link href={`/cameras/${camera}/editor`}>Mask & Zone creator</Link> <Link href={`/cameras/${camera}/editor`}>{t('title_mask_creation')}</Link>
</div> </div>
) : null; ) : null;
@ -111,9 +113,9 @@ export default function Camera({ camera }) {
<span className="w-5 h-5"> <span className="w-5 h-5">
<SettingsIcon /> <SettingsIcon />
</span>{' '} </span>{' '}
<span>{showSettings ? 'Hide' : 'Show'} Options</span> <span>{showSettings ? t('hide') : t('show')} {t('options')}</span>
</Button> </Button>
{showSettings ? <Card header="Options" elevated={false} content={optionContent} /> : null} {showSettings ? <Card header={t('options')} elevated={false} content={optionContent} /> : null}
</Fragment> </Fragment>
); );
} }
@ -126,7 +128,7 @@ export default function Camera({ camera }) {
{player} {player}
<div className="space-y-4"> <div className="space-y-4">
<Heading size="sm">Tracked objects</Heading> <Heading size="sm">{t('tracked_objects')}</Heading>
<div className="flex flex-wrap justify-start"> <div className="flex flex-wrap justify-start">
{cameraConfig.objects.track.map((objectType) => ( {cameraConfig.objects.track.map((objectType) => (
<Card <Card

View File

@ -200,7 +200,7 @@ ${Object.keys(objectMaskPoints)
return ( return (
<div className="flex-col space-y-4 p-2 px-4"> <div className="flex-col space-y-4 p-2 px-4">
<Heading size="2xl">{t('title_mask_creation') <Heading size="2xl">{t('title_mask_creation_camera')
.replace("{camera}", camera.replace("_", " ")) .replace("{camera}", camera.replace("_", " "))
} }
</Heading> </Heading>