mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 22:05:44 +03:00
fix: add more missing i18n
This commit is contained in:
parent
bae32f8e40
commit
96ed740a12
@ -72,7 +72,10 @@
|
|||||||
"formattedTimestampFilename": {
|
"formattedTimestampFilename": {
|
||||||
"12hour": "MM-dd-yy-h-mm-ss-a",
|
"12hour": "MM-dd-yy-h-mm-ss-a",
|
||||||
"24hour": "MM-dd-yy-HH-mm-ss"
|
"24hour": "MM-dd-yy-HH-mm-ss"
|
||||||
}
|
},
|
||||||
|
"inProgress": "In progress",
|
||||||
|
"invalidStartTime": "Invalid start time",
|
||||||
|
"invalidEndTime": "Invalid end time"
|
||||||
},
|
},
|
||||||
"unit": {
|
"unit": {
|
||||||
"speed": {
|
"speed": {
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
"snapshot": "snapshot",
|
"snapshot": "snapshot",
|
||||||
"thumbnail": "thumbnail",
|
"thumbnail": "thumbnail",
|
||||||
"video": "video",
|
"video": "video",
|
||||||
"object_lifecycle": "object lifecycle"
|
"tracking_details": "tracking details"
|
||||||
},
|
},
|
||||||
"trackingDetails": {
|
"trackingDetails": {
|
||||||
"title": "Tracking Details",
|
"title": "Tracking Details",
|
||||||
|
|||||||
@ -81,9 +81,9 @@ export default function InputWithTags({
|
|||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const allAudioListenLabels = useMemo<string[]>(() => {
|
const allAudioListenLabels = useMemo<Set<string>>(() => {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return [];
|
return new Set<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const labels = new Set<string>();
|
const labels = new Set<string>();
|
||||||
@ -94,9 +94,30 @@ export default function InputWithTags({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return [...labels].sort();
|
return labels;
|
||||||
}, [config]);
|
}, [config]);
|
||||||
|
|
||||||
|
const translatedAudioLabelMap = useMemo<Map<string, string>>(() => {
|
||||||
|
const map = new Map<string, string>();
|
||||||
|
if (!config) return map;
|
||||||
|
|
||||||
|
allAudioListenLabels.forEach((label) => {
|
||||||
|
// getTranslatedLabel likely depends on i18n internally; including `lang`
|
||||||
|
// in deps ensures this map is rebuilt when language changes
|
||||||
|
map.set(label, getTranslatedLabel(label, "audio"));
|
||||||
|
});
|
||||||
|
return map;
|
||||||
|
}, [allAudioListenLabels, config]);
|
||||||
|
|
||||||
|
function resolveLabel(value: string) {
|
||||||
|
const mapped = translatedAudioLabelMap.get(value);
|
||||||
|
if (mapped) return mapped;
|
||||||
|
return getTranslatedLabel(
|
||||||
|
value,
|
||||||
|
allAudioListenLabels.has(value) ? "audio" : "object",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const [inputValue, setInputValue] = useState(search || "");
|
const [inputValue, setInputValue] = useState(search || "");
|
||||||
const [currentFilterType, setCurrentFilterType] = useState<FilterType | null>(
|
const [currentFilterType, setCurrentFilterType] = useState<FilterType | null>(
|
||||||
null,
|
null,
|
||||||
@ -438,10 +459,7 @@ export default function InputWithTags({
|
|||||||
: t("button.no", { ns: "common" });
|
: t("button.no", { ns: "common" });
|
||||||
} else if (filterType === "labels") {
|
} else if (filterType === "labels") {
|
||||||
const value = String(filterValues);
|
const value = String(filterValues);
|
||||||
return getTranslatedLabel(
|
return resolveLabel(value);
|
||||||
value,
|
|
||||||
allAudioListenLabels.includes(value) ? "audio" : "object",
|
|
||||||
);
|
|
||||||
} else if (filterType === "search_type") {
|
} else if (filterType === "search_type") {
|
||||||
return t("filter.searchType." + String(filterValues));
|
return t("filter.searchType." + String(filterValues));
|
||||||
} else {
|
} else {
|
||||||
@ -848,12 +866,7 @@ export default function InputWithTags({
|
|||||||
>
|
>
|
||||||
{t("filter.label." + filterType)}:{" "}
|
{t("filter.label." + filterType)}:{" "}
|
||||||
{filterType === "labels" ? (
|
{filterType === "labels" ? (
|
||||||
getTranslatedLabel(
|
resolveLabel(value)
|
||||||
value,
|
|
||||||
allAudioListenLabels.includes(value)
|
|
||||||
? "audio"
|
|
||||||
: "object",
|
|
||||||
)
|
|
||||||
) : filterType === "cameras" ? (
|
) : filterType === "cameras" ? (
|
||||||
<CameraNameLabel camera={value} />
|
<CameraNameLabel camera={value} />
|
||||||
) : filterType === "zones" ? (
|
) : filterType === "zones" ? (
|
||||||
|
|||||||
@ -1155,7 +1155,7 @@ function ObjectDetailsTab({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row items-center gap-2 text-sm smart-capitalize">
|
<div className="flex flex-row items-center gap-2 text-sm smart-capitalize">
|
||||||
{getIconForLabel(search.label, "size-4 text-primary")}
|
{getIconForLabel(search.label, "size-4 text-primary")}
|
||||||
{getTranslatedLabel(search.label)}
|
{getTranslatedLabel(search.label, search.data.type)}
|
||||||
{search.sub_label && ` (${search.sub_label})`}
|
{search.sub_label && ` (${search.sub_label})`}
|
||||||
{isAdmin && search.end_time && (
|
{isAdmin && search.end_time && (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@ -1394,7 +1394,9 @@ function ObjectDetailsTab({
|
|||||||
{state == "submitted" && (
|
{state == "submitted" && (
|
||||||
<div className="flex flex-row items-center justify-center gap-2">
|
<div className="flex flex-row items-center justify-center gap-2">
|
||||||
<FaCheckCircle className="size-4 text-success" />
|
<FaCheckCircle className="size-4 text-success" />
|
||||||
{t("explore.plus.review.state.submitted")}
|
{t("explore.plus.review.state.submitted", {
|
||||||
|
ns: "components/dialog",
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -513,28 +513,8 @@ function EventList({
|
|||||||
|
|
||||||
const isSelected = selectedObjectIds.includes(event.id);
|
const isSelected = selectedObjectIds.includes(event.id);
|
||||||
|
|
||||||
const allAudioListenLabels = useMemo<string[]>(() => {
|
|
||||||
if (!config) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const labels = new Set<string>();
|
|
||||||
Object.values(config.cameras).forEach((camera) => {
|
|
||||||
if (camera?.audio?.enabled) {
|
|
||||||
camera.audio.listen.forEach((label) => {
|
|
||||||
labels.add(label);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return [...labels].sort();
|
|
||||||
}, [config]);
|
|
||||||
|
|
||||||
const label =
|
const label =
|
||||||
event.sub_label ||
|
event.sub_label || getTranslatedLabel(event.label, event.data.type);
|
||||||
getTranslatedLabel(
|
|
||||||
event.label,
|
|
||||||
allAudioListenLabels.includes(event.label) ? "audio" : "object",
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleObjectSelect = (event: Event | undefined) => {
|
const handleObjectSelect = (event: Event | undefined) => {
|
||||||
if (event) {
|
if (event) {
|
||||||
|
|||||||
@ -244,12 +244,12 @@ export const getDurationFromTimestamps = (
|
|||||||
abbreviated: boolean = false,
|
abbreviated: boolean = false,
|
||||||
): string => {
|
): string => {
|
||||||
if (isNaN(start_time)) {
|
if (isNaN(start_time)) {
|
||||||
return "Invalid start time";
|
return i18n.t("time.invalidStartTime", { ns: "common" });
|
||||||
}
|
}
|
||||||
let duration = "In Progress";
|
let duration = i18n.t("time.inProgress", { ns: "common" });
|
||||||
if (end_time !== null) {
|
if (end_time !== null) {
|
||||||
if (isNaN(end_time)) {
|
if (isNaN(end_time)) {
|
||||||
return "Invalid end time";
|
return i18n.t("time.invalidEndTime", { ns: "common" });
|
||||||
}
|
}
|
||||||
const start = fromUnixTime(start_time);
|
const start = fromUnixTime(start_time);
|
||||||
const end = fromUnixTime(end_time);
|
const end = fromUnixTime(end_time);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user