mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-23 04:09:04 +03:00
add config groups as a separate i18n namespace
This commit is contained in:
@@ -30,7 +30,18 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
||||
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
|
||||
const { t } = useTranslation([formContext?.i18nNamespace || "common"]);
|
||||
const { t } = useTranslation([
|
||||
formContext?.i18nNamespace || "common",
|
||||
"config/groups",
|
||||
]);
|
||||
|
||||
// Extract domain from i18nNamespace (e.g., "config/audio" -> "audio")
|
||||
const getDomainFromNamespace = (ns?: string): string => {
|
||||
if (!ns || !ns.startsWith("config/")) return "";
|
||||
return ns.replace("config/", "");
|
||||
};
|
||||
|
||||
const domain = getDomainFromNamespace(formContext?.i18nNamespace);
|
||||
|
||||
const groupDefinitions =
|
||||
(uiSchema?.["ui:groups"] as Record<string, string[]> | undefined) || {};
|
||||
@@ -120,9 +131,14 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
||||
|
||||
ordered.forEach((item) => grouped.add(item.name));
|
||||
|
||||
const label = t(`groups.${groupKey}`, {
|
||||
defaultValue: toTitle(groupKey),
|
||||
});
|
||||
const label = domain
|
||||
? t(`${domain}.${groupKey}`, {
|
||||
ns: "config/groups",
|
||||
defaultValue: toTitle(groupKey),
|
||||
})
|
||||
: t(`groups.${groupKey}`, {
|
||||
defaultValue: toTitle(groupKey),
|
||||
});
|
||||
|
||||
return {
|
||||
key: groupKey,
|
||||
|
||||
@@ -73,6 +73,7 @@ i18n
|
||||
"config/face_recognition",
|
||||
"config/lpr",
|
||||
"config/validation",
|
||||
"config/groups",
|
||||
],
|
||||
defaultNS: "common",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user