Add debug tranlsations

This commit is contained in:
Nick Mowen 2022-08-27 11:12:31 -06:00
parent 47f36693c3
commit 907b3752e1
2 changed files with 15 additions and 7 deletions

View File

@ -2,23 +2,29 @@
"all": "All", "all": "All",
"all_cameras": "All Cameras", "all_cameras": "All Cameras",
"all_labels": "All Labels", "all_labels": "All Labels",
"all_sub_labels": "All Sub Labels" "all_sub_labels": "All Sub Labels",
"all_zones": "All Zones", "all_zones": "All Zones",
"are_you_sure": "Are you sure?", "are_you_sure": "Are you sure?",
"auto_dark_mode": "Auto Dark Mode", "auto_dark_mode": "Auto Dark Mode",
"best_image": "Best Image", "best_image": "Best Image",
"birdseye": "Birdseye", "birdseye": "Birdseye",
"_camera": "camera",
"camera": "Camera",
"cameras": "Cameras", "cameras": "Cameras",
"cancel": "Cancel", "cancel": "Cancel",
"clip": "Clip", "clip": "Clip",
"close": "Close", "close": "Close",
"_confidence": "confidence", "_confidence": "confidence",
"config": "Config",
"copy_clipboard": "Copy To Clipboard",
"custom_range": "Custom Range", "custom_range": "Custom Range",
"dark": "Dark", "dark": "Dark",
"debug": "Debug", "debug": "Debug",
"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_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",
"documentation": "Documentation", "documentation": "Documentation",
"download_clip": "Download Clip", "download_clip": "Download Clip",
"download_snapshot": "Download Snapshot", "download_snapshot": "Download Snapshot",

View File

@ -7,10 +7,12 @@ import { useMqtt } from '../api/mqtt';
import useSWR from 'swr'; import useSWR from 'swr';
import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table'; import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table';
import { useCallback } from 'preact/hooks'; import { useCallback } from 'preact/hooks';
import { useTranslation } from 'react-i18next';
const emptyObject = Object.freeze({}); const emptyObject = Object.freeze({});
export default function Debug() { export default function Debug() {
const { t } = useTranslation();
const { data: config } = useSWR('config'); const { data: config } = useSWR('config');
const { const {
@ -35,7 +37,7 @@ export default function Debug() {
return ( return (
<div className="space-y-4 p-2 px-4"> <div className="space-y-4 p-2 px-4">
<Heading> <Heading>
Debug <span className="text-sm">{service.version}</span> {t('debug')} <span className="text-sm">{service.version}</span>
</Heading> </Heading>
{!detectors ? ( {!detectors ? (
@ -48,7 +50,7 @@ export default function Debug() {
<Table className="w-full"> <Table className="w-full">
<Thead> <Thead>
<Tr> <Tr>
<Th>detector</Th> <Th>{t('_detector')}</Th>
{detectorDataKeys.map((name) => ( {detectorDataKeys.map((name) => (
<Th key={name}>{name.replace('_', ' ')}</Th> <Th key={name}>{name.replace('_', ' ')}</Th>
))} ))}
@ -71,7 +73,7 @@ export default function Debug() {
<Table className="w-full"> <Table className="w-full">
<Thead> <Thead>
<Tr> <Tr>
<Th>camera</Th> <Th>{t('_camera')}</Th>
{cameraDataKeys.map((name) => ( {cameraDataKeys.map((name) => (
<Th key={name}>{name.replace('_', ' ')}</Th> <Th key={name}>{name.replace('_', ' ')}</Th>
))} ))}
@ -92,14 +94,14 @@ export default function Debug() {
</Table> </Table>
</div> </div>
<p>Debug stats update automatically every {config.mqtt.stats_interval} seconds.</p> <p>{t('debug_update_interval').replace("{interval}", config.mqtt.stats_interval)}</p>
</Fragment> </Fragment>
)} )}
<div className="relative"> <div className="relative">
<Heading size="sm">Config</Heading> <Heading size="sm">{t('config')}</Heading>
<Button className="absolute top-8 right-4" onClick={handleCopyConfig}> <Button className="absolute top-8 right-4" onClick={handleCopyConfig}>
Copy to Clipboard {t('copy_clipboard')}
</Button> </Button>
<pre className="overflow-auto font-mono text-gray-900 dark:text-gray-100 rounded bg-gray-100 dark:bg-gray-800 p-2 max-h-96"> <pre className="overflow-auto font-mono text-gray-900 dark:text-gray-100 rounded bg-gray-100 dark:bg-gray-800 p-2 max-h-96">
{JSON.stringify(config, null, 2)} {JSON.stringify(config, null, 2)}