mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-15 00:11:15 +03:00
use label i18n
This commit is contained in:
parent
3499d24f32
commit
b870928510
@ -111,7 +111,11 @@ function groupDeltasBySource(deltas: FieldDelta[]): SourceGroup[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function CameraEntry({ sectionPath, entry, cameraPage }: CameraEntryProps) {
|
function CameraEntry({ sectionPath, entry, cameraPage }: CameraEntryProps) {
|
||||||
const { t, i18n } = useTranslation(["config/global", "views/settings"]);
|
const { t, i18n } = useTranslation([
|
||||||
|
"config/global",
|
||||||
|
"views/settings",
|
||||||
|
"objects",
|
||||||
|
]);
|
||||||
const friendlyName = useCameraFriendlyName(entry.camera);
|
const friendlyName = useCameraFriendlyName(entry.camera);
|
||||||
const { data: profilesData } = useSWR<ProfilesApiResponse>("profiles");
|
const { data: profilesData } = useSWR<ProfilesApiResponse>("profiles");
|
||||||
|
|
||||||
@ -149,8 +153,14 @@ function CameraEntry({ sectionPath, entry, cameraPage }: CameraEntryProps) {
|
|||||||
const reducedKey = `${sectionPath}.${reduced}.label`;
|
const reducedKey = `${sectionPath}.${reduced}.label`;
|
||||||
if (i18n.exists(reducedKey, { ns: "config/global" })) {
|
if (i18n.exists(reducedKey, { ns: "config/global" })) {
|
||||||
const resolvedLabel = t(reducedKey, { ns: "config/global" });
|
const resolvedLabel = t(reducedKey, { ns: "config/global" });
|
||||||
const entry = humanizeKey(segments[i]);
|
const dropped = segments[i];
|
||||||
return `${entry} · ${resolvedLabel}`;
|
// Object class names ("person", "car", "fox") have translations in
|
||||||
|
// the `objects` namespace; fall back to humanizing the raw key for
|
||||||
|
// anything that isn't a known label.
|
||||||
|
const droppedLabel = i18n.exists(dropped, { ns: "objects" })
|
||||||
|
? t(dropped, { ns: "objects" })
|
||||||
|
: humanizeKey(dropped);
|
||||||
|
return `${droppedLabel} · ${resolvedLabel}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user