From 19dcad7989fb49ad2710b2bd9553f52dcb9ac7a2 Mon Sep 17 00:00:00 2001 From: ZhaiSoul <842607283@qq.com> Date: Tue, 12 May 2026 16:51:03 +0800 Subject: [PATCH] fix: fix setting i18n --- web/public/locales/en/config/cameras.json | 8 ++++-- web/public/locales/en/config/global.json | 8 ++++-- web/public/locales/en/views/settings.json | 26 ++++++++++++++----- .../config-form/section-configs/audio.ts | 1 + .../section-configs/audio_transcription.ts | 5 ++++ .../section-configs/face_recognition.ts | 2 +- .../config-form/section-configs/onvif.ts | 5 ++++ .../config-form/section-configs/record.ts | 11 ++++++++ .../config-form/section-configs/snapshots.ts | 2 +- .../theme/templates/ObjectFieldTemplate.tsx | 20 +++++++------- 10 files changed, 66 insertions(+), 22 deletions(-) diff --git a/web/public/locales/en/config/cameras.json b/web/public/locales/en/config/cameras.json index 65f9815753..f645dd33a1 100644 --- a/web/public/locales/en/config/cameras.json +++ b/web/public/locales/en/config/cameras.json @@ -33,7 +33,11 @@ }, "filters": { "label": "Audio filters", - "description": "Per-audio-type filter settings such as confidence thresholds used to reduce false positives." + "description": "Per-audio-type filter settings such as confidence thresholds used to reduce false positives.", + "threshold": { + "label": "Minimum audio confidence", + "description": "Minimum confidence threshold for the audio event to be counted." + } }, "enabled_in_config": { "label": "Original audio state", @@ -946,4 +950,4 @@ "label": "Original camera state", "description": "Keep track of original state of camera." } -} +} \ No newline at end of file diff --git a/web/public/locales/en/config/global.json b/web/public/locales/en/config/global.json index 8efecd0ced..b10f0a7afc 100644 --- a/web/public/locales/en/config/global.json +++ b/web/public/locales/en/config/global.json @@ -559,7 +559,11 @@ }, "filters": { "label": "Audio filters", - "description": "Per-audio-type filter settings such as confidence thresholds used to reduce false positives." + "description": "Per-audio-type filter settings such as confidence thresholds used to reduce false positives.", + "threshold": { + "label": "Minimum audio confidence", + "description": "Minimum confidence threshold for the audio event to be counted." + } }, "enabled_in_config": { "label": "Original audio state", @@ -1593,4 +1597,4 @@ "description": "Ignore time synchronization differences between camera and Frigate server for ONVIF communication." } } -} +} \ No newline at end of file diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index b47b6ba39d..5f06668db7 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -1650,12 +1650,17 @@ "continuous": "Continuous" } }, - "snapshot": { - "retainMode": { - "all": "All", - "motion": "Motion", - "active_objects": "Active Objects" - } + "retainMode": { + "all": "All", + "motion": "Motion", + "active_objects": "Active Objects" + }, + "previewQuality": { + "very_high": "Very High", + "high": "High", + "medium": "Medium", + "low": "Low", + "very_low": "Very Low" }, "ui": { "timeFormat": { @@ -1691,7 +1696,14 @@ }, "onvif": { "profileAuto": "Auto", - "profileLoading": "Loading profiles..." + "profileLoading": "Loading profiles...", + "autotracking": { + "zooming": { + "disabled": "Disabled", + "absolute": "Absolute", + "relative": "Relative" + } + } }, "modelSize": { "small": "Small", diff --git a/web/src/components/config-form/section-configs/audio.ts b/web/src/components/config-form/section-configs/audio.ts index 31f19e93de..dda6198c52 100644 --- a/web/src/components/config-form/section-configs/audio.ts +++ b/web/src/components/config-form/section-configs/audio.ts @@ -42,6 +42,7 @@ const audio: SectionConfigOverrides = { "filters.*": { "ui:options": { additionalPropertyKeyReadonly: true, + isAudioLabels: true, }, }, listen: { diff --git a/web/src/components/config-form/section-configs/audio_transcription.ts b/web/src/components/config-form/section-configs/audio_transcription.ts index fbc0c1dc0c..0983708a25 100644 --- a/web/src/components/config-form/section-configs/audio_transcription.ts +++ b/web/src/components/config-form/section-configs/audio_transcription.ts @@ -25,6 +25,11 @@ const audioTranscription: SectionConfigOverrides = { hiddenFields: ["enabled_in_config", "live_enabled"], advancedFields: ["language", "device", "model_size"], overrideFields: ["enabled", "live_enabled"], + uiSchema: { + model_size: { + "ui:options": { size: "xs", enumI18nPrefix: "modelSize" }, + }, + }, }, global: { fieldOrder: ["enabled", "language", "device", "model_size"], diff --git a/web/src/components/config-form/section-configs/face_recognition.ts b/web/src/components/config-form/section-configs/face_recognition.ts index 9d346b26c6..031152fff7 100644 --- a/web/src/components/config-form/section-configs/face_recognition.ts +++ b/web/src/components/config-form/section-configs/face_recognition.ts @@ -65,7 +65,7 @@ const faceRecognition: SectionConfigOverrides = { ], uiSchema: { model_size: { - "ui:options": { size: "xs" }, + "ui:options": { size: "xs", enumI18nPrefix: "modelSize" }, }, }, }, diff --git a/web/src/components/config-form/section-configs/onvif.ts b/web/src/components/config-form/section-configs/onvif.ts index acfb68f167..71163a0341 100644 --- a/web/src/components/config-form/section-configs/onvif.ts +++ b/web/src/components/config-form/section-configs/onvif.ts @@ -39,6 +39,11 @@ const onvif: SectionConfigOverrides = { track: { "ui:widget": "objectLabels", }, + zooming: { + "ui:options": { + enumI18nPrefix: "onvif.autotracking.zooming", + }, + }, }, }, }, diff --git a/web/src/components/config-form/section-configs/record.ts b/web/src/components/config-form/section-configs/record.ts index 1d47454d76..0e0da30692 100644 --- a/web/src/components/config-form/section-configs/record.ts +++ b/web/src/components/config-form/section-configs/record.ts @@ -49,6 +49,17 @@ const record: SectionConfigOverrides = { "ui:options": { suppressMultiSchema: true, size: "lg" }, }, }, + "alerts.retain.mode": { + "ui:options": { enumI18nPrefix: "retainMode" }, + }, + "detections.retain.mode": { + "ui:options": { enumI18nPrefix: "retainMode" }, + }, + "preview.quality": { + "ui:options": { + enumI18nPrefix: "previewQuality", + }, + }, }, }, global: { diff --git a/web/src/components/config-form/section-configs/snapshots.ts b/web/src/components/config-form/section-configs/snapshots.ts index 48d6fe92a2..94bfd9dc8f 100644 --- a/web/src/components/config-form/section-configs/snapshots.ts +++ b/web/src/components/config-form/section-configs/snapshots.ts @@ -37,7 +37,7 @@ const snapshots: SectionConfigOverrides = { }, "retain.mode": { "ui:options": { - enumI18nPrefix: "snapshot.retainMode", + enumI18nPrefix: "retainMode", }, }, }, diff --git a/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx b/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx index 78f08098c5..29cf4c310c 100644 --- a/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx +++ b/web/src/components/config-form/theme/templates/ObjectFieldTemplate.tsx @@ -157,9 +157,8 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) { const hasModifiedDescendants = checkSubtreeModified(fieldPath); const [isOpen, setIsOpen] = useState(hasModifiedDescendants); - const resetKey = `${formContext?.level ?? "global"}::${ - formContext?.cameraName ?? "global" - }`; + const resetKey = `${formContext?.level ?? "global"}::${formContext?.cameraName ?? "global" + }`; const lastResetKeyRef = useRef(null); // Auto-expand collapsible when modifications are detected @@ -210,6 +209,9 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) { (p.content.props as RjsfElementProps).uiSchema?.["ui:options"] ?.advanced !== true, ); + + const isAudioLabels = uiSchema?.["ui:options"]?.isAudioLabels === true; + const hasModifiedAdvanced = advancedProps.some((prop) => checkSubtreeModified([...fieldPath, prop.name]), ); @@ -243,7 +245,7 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) { const path = fieldPathId?.path; const filterObjectLabel = path ? getFilterObjectLabel(path) : undefined; const translatedFilterLabel = filterObjectLabel - ? getTranslatedLabel(filterObjectLabel, "object") + ? getTranslatedLabel(filterObjectLabel, isAudioLabels ? "audio" : "object") : undefined; if (path) { translationPath = buildTranslationPath( @@ -334,12 +336,12 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) { const label = domain ? t(`${sectionI18nPrefix}.${domain}.${groupKey}`, { - ns: "config/groups", - defaultValue: humanizeKey(groupKey), - }) + ns: "config/groups", + defaultValue: humanizeKey(groupKey), + }) : t(`groups.${groupKey}`, { - defaultValue: humanizeKey(groupKey), - }); + defaultValue: humanizeKey(groupKey), + }); const groupInfo = { groupKey, label, items: ordered }; for (const item of ordered) {