Add camera map translations

This commit is contained in:
Nick Mowen 2022-08-27 11:31:27 -06:00
parent b74f142e55
commit f2ebdc123c
2 changed files with 26 additions and 11 deletions

View File

@ -12,6 +12,7 @@
"camera": "Camera", "camera": "Camera",
"cameras": "Cameras", "cameras": "Cameras",
"cancel": "Cancel", "cancel": "Cancel",
"click_to_edit": "Click To Edit",
"clip": "Clip", "clip": "Clip",
"close": "Close", "close": "Close",
"_confidence": "confidence", "_confidence": "confidence",
@ -23,6 +24,7 @@
"debug_update_interval": "Debug stats update automatically every {interval} seconds.", "debug_update_interval": "Debug stats update automatically every {interval} seconds.",
"delete": "Delete", "delete": "Delete",
"desc_delete_saved_event": "Confirm deletion of saved event.", "desc_delete_saved_event": "Confirm deletion of saved event.",
"desc_mask_creation": "This tool can help you create masks & zones for your {camera} camera. When done, copy each mask configuration into your config.yml file restart your Frigate instance to save your changes.",
"desc_no_recordings": "Make sure you have enabled the record role in your configuration for the {camera} camera.", "desc_no_recordings": "Make sure you have enabled the record role in your configuration for the {camera} camera.",
"_detector": "detector", "_detector": "detector",
"documentation": "Documentation", "documentation": "Documentation",
@ -34,7 +36,10 @@
"last_month": "Last Month", "last_month": "Last Month",
"last_seven_days": "Last Seven Days", "last_seven_days": "Last Seven Days",
"light": "Light", "light": "Light",
"motion_masks": "Motion Masks",
"object_masks": "Object Masks",
"recordings": "Recordings", "recordings": "Recordings",
"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+",
@ -43,6 +48,7 @@
"this_month": "This Month", "this_month": "This Month",
"thumbnail": "Thumbnail", "thumbnail": "Thumbnail",
"title_delete_saved_event": "Delete Saved Event?", "title_delete_saved_event": "Delete Saved Event?",
"title_mask_creation": "{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",
@ -50,6 +56,8 @@
"toggle_snapshots": "Toggle Snapshots", "toggle_snapshots": "Toggle Snapshots",
"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",
"yes": "Yes", "yes": "Yes",
"yesterday": "Yesterday" "yesterday": "Yesterday",
"zones": "Zones"
} }

View File

@ -7,8 +7,10 @@ import { useResizeObserver } from '../hooks';
import { useCallback, useMemo, useRef, useState } from 'preact/hooks'; import { useCallback, useMemo, useRef, 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';
export default function CameraMasks({ camera }) { export default function CameraMasks({ camera }) {
const { t } = useTranslation();
const { data: config } = useSWR('config'); const { data: config } = useSWR('config');
const apiHost = useApiHost(); const apiHost = useApiHost();
const imageRef = useRef(null); const imageRef = useRef(null);
@ -198,17 +200,20 @@ ${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">{camera} mask & zone creator</Heading> <Heading size="2xl">{t('title_mask_creation')
.replace("{camera}", camera.replace("_", " "))
}
</Heading>
<Card <Card
content={ content={
<p> <p>
This tool can help you create masks & zones for your {camera} camera. When done, copy each mask {t('desc_mask_creation')
configuration into your <code className="font-mono">config.yml</code> file restart your Frigate instance to .replace("{camera}", camera.replace("_", " "))
save your changes. }
</p> </p>
} }
header="Warning" header={t('warning')}
/> />
<div className="space-y-4"> <div className="space-y-4">
@ -231,7 +236,7 @@ ${Object.keys(objectMaskPoints)
<div className="flex-col space-y-4"> <div className="flex-col space-y-4">
<MaskValues <MaskValues
editing={editing} editing={editing}
title="Motion masks" title={t('motion_masks')}
onCopy={handleCopyMotionMasks} onCopy={handleCopyMotionMasks}
onCreate={handleAddMask} onCreate={handleAddMask}
onEdit={handleEditMask} onEdit={handleEditMask}
@ -243,7 +248,7 @@ ${Object.keys(objectMaskPoints)
<MaskValues <MaskValues
editing={editing} editing={editing}
title="Zones" title={t('zones')}
onCopy={handleCopyZones} onCopy={handleCopyZones}
onCreate={handleAddZone} onCreate={handleAddZone}
onEdit={handleEditZone} onEdit={handleEditZone}
@ -256,7 +261,7 @@ ${Object.keys(objectMaskPoints)
<MaskValues <MaskValues
isMulti isMulti
editing={editing} editing={editing}
title="Object masks" title={t('object_masks')}
onAdd={handleAddToObjectMask} onAdd={handleAddToObjectMask}
onCopy={handleCopyObjectMasks} onCopy={handleCopyObjectMasks}
onCreate={handleAddObjectMask} onCreate={handleAddObjectMask}
@ -499,6 +504,8 @@ function MaskValues({
} }
function Item({ mainkey, subkey, editing, handleEdit, points, showButtons, _handleAdd, handleRemove, yamlKeyPrefix }) { function Item({ mainkey, subkey, editing, handleEdit, points, showButtons, _handleAdd, handleRemove, yamlKeyPrefix }) {
const { t } = useTranslation();
return ( return (
<span <span
data-key={mainkey} data-key={mainkey}
@ -507,7 +514,7 @@ function Item({ mainkey, subkey, editing, handleEdit, points, showButtons, _hand
editing.key === mainkey && editing.subkey === subkey ? 'text-blue-800 dark:text-blue-600' : '' editing.key === mainkey && editing.subkey === subkey ? 'text-blue-800 dark:text-blue-600' : ''
}`} }`}
onClick={handleEdit} onClick={handleEdit}
title="Click to edit" title={t('click_to_edit')}
> >
{`${yamlKeyPrefix(points, mainkey, subkey)}${polylinePointsToPolyline(points)}`} {`${yamlKeyPrefix(points, mainkey, subkey)}${polylinePointsToPolyline(points)}`}
{showButtons ? ( {showButtons ? (
@ -518,7 +525,7 @@ function Item({ mainkey, subkey, editing, handleEdit, points, showButtons, _hand
data-subkey={subkey} data-subkey={subkey}
onClick={handleRemove} onClick={handleRemove}
> >
Remove {t('remove')}
</Button> </Button>
) : null} ) : null}
</span> </span>