fix: fix setting i18n

This commit is contained in:
ZhaiSoul 2026-05-12 16:51:03 +08:00
parent 57ee01b1ed
commit 19dcad7989
10 changed files with 66 additions and 22 deletions

View File

@ -33,7 +33,11 @@
}, },
"filters": { "filters": {
"label": "Audio 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": { "enabled_in_config": {
"label": "Original audio state", "label": "Original audio state",
@ -946,4 +950,4 @@
"label": "Original camera state", "label": "Original camera state",
"description": "Keep track of original state of camera." "description": "Keep track of original state of camera."
} }
} }

View File

@ -559,7 +559,11 @@
}, },
"filters": { "filters": {
"label": "Audio 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": { "enabled_in_config": {
"label": "Original audio state", "label": "Original audio state",
@ -1593,4 +1597,4 @@
"description": "Ignore time synchronization differences between camera and Frigate server for ONVIF communication." "description": "Ignore time synchronization differences between camera and Frigate server for ONVIF communication."
} }
} }
} }

View File

@ -1650,12 +1650,17 @@
"continuous": "Continuous" "continuous": "Continuous"
} }
}, },
"snapshot": { "retainMode": {
"retainMode": { "all": "All",
"all": "All", "motion": "Motion",
"motion": "Motion", "active_objects": "Active Objects"
"active_objects": "Active Objects" },
} "previewQuality": {
"very_high": "Very High",
"high": "High",
"medium": "Medium",
"low": "Low",
"very_low": "Very Low"
}, },
"ui": { "ui": {
"timeFormat": { "timeFormat": {
@ -1691,7 +1696,14 @@
}, },
"onvif": { "onvif": {
"profileAuto": "Auto", "profileAuto": "Auto",
"profileLoading": "Loading profiles..." "profileLoading": "Loading profiles...",
"autotracking": {
"zooming": {
"disabled": "Disabled",
"absolute": "Absolute",
"relative": "Relative"
}
}
}, },
"modelSize": { "modelSize": {
"small": "Small", "small": "Small",

View File

@ -42,6 +42,7 @@ const audio: SectionConfigOverrides = {
"filters.*": { "filters.*": {
"ui:options": { "ui:options": {
additionalPropertyKeyReadonly: true, additionalPropertyKeyReadonly: true,
isAudioLabels: true,
}, },
}, },
listen: { listen: {

View File

@ -25,6 +25,11 @@ const audioTranscription: SectionConfigOverrides = {
hiddenFields: ["enabled_in_config", "live_enabled"], hiddenFields: ["enabled_in_config", "live_enabled"],
advancedFields: ["language", "device", "model_size"], advancedFields: ["language", "device", "model_size"],
overrideFields: ["enabled", "live_enabled"], overrideFields: ["enabled", "live_enabled"],
uiSchema: {
model_size: {
"ui:options": { size: "xs", enumI18nPrefix: "modelSize" },
},
},
}, },
global: { global: {
fieldOrder: ["enabled", "language", "device", "model_size"], fieldOrder: ["enabled", "language", "device", "model_size"],

View File

@ -65,7 +65,7 @@ const faceRecognition: SectionConfigOverrides = {
], ],
uiSchema: { uiSchema: {
model_size: { model_size: {
"ui:options": { size: "xs" }, "ui:options": { size: "xs", enumI18nPrefix: "modelSize" },
}, },
}, },
}, },

View File

@ -39,6 +39,11 @@ const onvif: SectionConfigOverrides = {
track: { track: {
"ui:widget": "objectLabels", "ui:widget": "objectLabels",
}, },
zooming: {
"ui:options": {
enumI18nPrefix: "onvif.autotracking.zooming",
},
},
}, },
}, },
}, },

View File

@ -49,6 +49,17 @@ const record: SectionConfigOverrides = {
"ui:options": { suppressMultiSchema: true, size: "lg" }, "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: { global: {

View File

@ -37,7 +37,7 @@ const snapshots: SectionConfigOverrides = {
}, },
"retain.mode": { "retain.mode": {
"ui:options": { "ui:options": {
enumI18nPrefix: "snapshot.retainMode", enumI18nPrefix: "retainMode",
}, },
}, },
}, },

View File

@ -157,9 +157,8 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
const hasModifiedDescendants = checkSubtreeModified(fieldPath); const hasModifiedDescendants = checkSubtreeModified(fieldPath);
const [isOpen, setIsOpen] = useState(hasModifiedDescendants); const [isOpen, setIsOpen] = useState(hasModifiedDescendants);
const resetKey = `${formContext?.level ?? "global"}::${ const resetKey = `${formContext?.level ?? "global"}::${formContext?.cameraName ?? "global"
formContext?.cameraName ?? "global" }`;
}`;
const lastResetKeyRef = useRef<string | null>(null); const lastResetKeyRef = useRef<string | null>(null);
// Auto-expand collapsible when modifications are detected // Auto-expand collapsible when modifications are detected
@ -210,6 +209,9 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
(p.content.props as RjsfElementProps).uiSchema?.["ui:options"] (p.content.props as RjsfElementProps).uiSchema?.["ui:options"]
?.advanced !== true, ?.advanced !== true,
); );
const isAudioLabels = uiSchema?.["ui:options"]?.isAudioLabels === true;
const hasModifiedAdvanced = advancedProps.some((prop) => const hasModifiedAdvanced = advancedProps.some((prop) =>
checkSubtreeModified([...fieldPath, prop.name]), checkSubtreeModified([...fieldPath, prop.name]),
); );
@ -243,7 +245,7 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
const path = fieldPathId?.path; const path = fieldPathId?.path;
const filterObjectLabel = path ? getFilterObjectLabel(path) : undefined; const filterObjectLabel = path ? getFilterObjectLabel(path) : undefined;
const translatedFilterLabel = filterObjectLabel const translatedFilterLabel = filterObjectLabel
? getTranslatedLabel(filterObjectLabel, "object") ? getTranslatedLabel(filterObjectLabel, isAudioLabels ? "audio" : "object")
: undefined; : undefined;
if (path) { if (path) {
translationPath = buildTranslationPath( translationPath = buildTranslationPath(
@ -334,12 +336,12 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
const label = domain const label = domain
? t(`${sectionI18nPrefix}.${domain}.${groupKey}`, { ? t(`${sectionI18nPrefix}.${domain}.${groupKey}`, {
ns: "config/groups", ns: "config/groups",
defaultValue: humanizeKey(groupKey), defaultValue: humanizeKey(groupKey),
}) })
: t(`groups.${groupKey}`, { : t(`groups.${groupKey}`, {
defaultValue: humanizeKey(groupKey), defaultValue: humanizeKey(groupKey),
}); });
const groupInfo = { groupKey, label, items: ordered }; const groupInfo = { groupKey, label, items: ordered };
for (const item of ordered) { for (const item of ordered) {