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