fix missing i18n keys (#18309)

This commit is contained in:
Josh Hawkins
2025-05-19 16:45:02 -05:00
committed by GitHub
parent 8a143b4284
commit afe513336c
19 changed files with 103 additions and 46 deletions
@@ -132,14 +132,14 @@ export default function CameraInfoDialog({
/
{codec.height /
gcd(codec.width, codec.height)}{" "}
aspect ratio)
{t("cameras.info.aspectRatio")})
</span>
</>
) : (
<span>
{t("cameras.info.resolution")}{" "}
<span className="text-primary">
Unknown
t("cameras.info.unknown")
</span>
</span>
)}
@@ -56,8 +56,10 @@ export default function CreateUserDialog({
.regex(/^[A-Za-z0-9._]+$/, {
message: t("users.dialog.createUser.usernameOnlyInclude"),
}),
password: z.string().min(1, "Password is required"),
confirmPassword: z.string().min(1, "Please confirm your password"),
password: z.string().min(1, t("users.dialog.form.passwordIsRequired")),
confirmPassword: z
.string()
.min(1, t("users.dialog.createUser.confirmPassword")),
role: z.enum(["admin", "viewer"]),
})
.refine((data) => data.password === data.confirmPassword, {
@@ -79,8 +79,8 @@ export default function FaceSelectionDialog({
>
{isMobile && (
<DrawerHeader className="sr-only">
<DrawerTitle>Log Details</DrawerTitle>
<DrawerDescription>Log details</DrawerDescription>
<DrawerTitle>Details</DrawerTitle>
<DrawerDescription>Details</DrawerDescription>
</DrawerHeader>
)}
<DropdownMenuLabel>{t("trainFaceAs")}</DropdownMenuLabel>
@@ -4,6 +4,7 @@ import { Button } from "../ui/button";
import { FaFlag } from "react-icons/fa";
import { TimelineType } from "@/types/timeline";
import { isMobile } from "react-device-detect";
import { useTranslation } from "react-i18next";
type MobileTimelineDrawerProps = {
selected: TimelineType;
@@ -13,6 +14,7 @@ export default function MobileTimelineDrawer({
selected,
onSelect,
}: MobileTimelineDrawerProps) {
const { t } = useTranslation(["views/events"]);
const [drawer, setDrawer] = useState(false);
if (!isMobile) {
@@ -38,7 +40,7 @@ export default function MobileTimelineDrawer({
setDrawer(false);
}}
>
Timeline
{t("timeline")}
</div>
<div
className={`mx-4 w-full py-2 text-center smart-capitalize ${selected == "events" ? "rounded-lg bg-secondary" : ""}`}
@@ -47,7 +49,7 @@ export default function MobileTimelineDrawer({
setDrawer(false);
}}
>
Events
{t("events.label")}
</div>
</DrawerContent>
</Drawer>
@@ -83,7 +83,7 @@ export default function RoleChangeDialog({
}
>
<SelectTrigger className="w-full">
<SelectValue placeholder="Select a role" />
<SelectValue placeholder={t("users.dialog.changeRole.select")} />
</SelectTrigger>
<SelectContent>
<SelectItem value="admin" className="flex items-center gap-2">
@@ -66,12 +66,12 @@ export default function SetPasswordDialog({
const handleSave = () => {
if (!password) {
setError("Password cannot be empty");
setError(t("users.dialog.passwordSetting.cannotBeEmpty"));
return;
}
if (password !== confirmPassword) {
setError("Passwords do not match");
setError(t("users.dialog.passwordSetting.doNotMatch"));
return;
}
@@ -77,7 +77,9 @@ export function AnnotationSettingsPane({
.then((res) => {
if (res.status === 200) {
toast.success(
`Annotation offset for ${event?.camera} has been saved to the config file. Restart Frigate to apply your changes.`,
t("objectLifecycle.annotationSettings.offset.toast.success", {
camera: event?.camera,
}),
{
position: "top-center",
},
@@ -909,7 +909,9 @@ function ObjectDetailsTab({
search.label,
)) ? (
<>
<div className="text-sm text-primary/40">Description</div>
<div className="text-sm text-primary/40">
{t("details.description.label")}
</div>
<div className="flex h-64 flex-col items-center justify-center gap-3 border p-4 text-sm text-primary/40">
<div className="flex">
<ActivityIndicator />
@@ -240,11 +240,13 @@ export function CameraStreamingDialog({
Object.entries(config?.cameras[camera].live.streams).length > 0 && (
<div className="flex flex-col items-start gap-2">
<Label htmlFor="stream" className="text-right">
Stream
{t("group.camera.setting.stream")}
</Label>
<Select value={streamName} onValueChange={setStreamName}>
<SelectTrigger className="">
<SelectValue placeholder="Choose a stream" />
<SelectValue
placeholder={t("group.camera.setting.placeholder")}
/>
</SelectTrigger>
<SelectContent>
{camera !== "birdseye" &&
@@ -305,7 +307,9 @@ export function CameraStreamingDialog({
onValueChange={(value) => setStreamType(value as StreamType)}
>
<SelectTrigger className="">
<SelectValue placeholder="Choose a streaming option" />
<SelectValue
placeholder={t("group.camera.setting.streamMethod.placeholder")}
/>
</SelectTrigger>
<SelectContent>
<SelectItem value="no-streaming">
@@ -99,8 +99,11 @@ export default function ObjectMaskEditPane({
objectType = objects;
}
return `Object Mask ${count + 1} (${objectType})`;
}, [polygons, polygon]);
return t("masksAndZones.objectMaskLabel", {
number: count + 1,
label: t(objectType, { ns: "objects" }),
});
}, [polygons, polygon, t]);
const formSchema = z
.object({
+37 -21
View File
@@ -200,7 +200,7 @@ export default function ZoneEditPane({
speed_threshold: z.coerce
.number()
.min(0.1, {
message: "Speed threshold must be greater than or equal to 0.1",
message: t("masksAndZones.form.speed.error.mustBeGreaterOrEqualTo"),
})
.optional()
.or(z.literal("")),
@@ -699,11 +699,15 @@ export default function ZoneEditPane({
render={({ field }) => (
<FormItem>
<FormLabel>
Line A distance (
{config?.ui.unit_system == "imperial"
? "feet"
: "meters"}
)
{t(
"masksAndZones.zones.speedEstimation.lineADistance",
{
unit:
config?.ui.unit_system == "imperial"
? t("feet", { ns: "common" })
: t("meters", { ns: "common" }),
},
)}
</FormLabel>
<FormControl>
<Input
@@ -722,11 +726,15 @@ export default function ZoneEditPane({
render={({ field }) => (
<FormItem>
<FormLabel>
Line B distance (
{config?.ui.unit_system == "imperial"
? "feet"
: "meters"}
)
{t(
"masksAndZones.zones.speedEstimation.lineBDistance",
{
unit:
config?.ui.unit_system == "imperial"
? t("feet", { ns: "common" })
: t("meters", { ns: "common" }),
},
)}
</FormLabel>
<FormControl>
<Input
@@ -745,11 +753,15 @@ export default function ZoneEditPane({
render={({ field }) => (
<FormItem>
<FormLabel>
Line C distance (
{config?.ui.unit_system == "imperial"
? "feet"
: "meters"}
)
{t(
"masksAndZones.zones.speedEstimation.lineCDistance",
{
unit:
config?.ui.unit_system == "imperial"
? t("feet", { ns: "common" })
: t("meters", { ns: "common" }),
},
)}
</FormLabel>
<FormControl>
<Input
@@ -768,11 +780,15 @@ export default function ZoneEditPane({
render={({ field }) => (
<FormItem>
<FormLabel>
Line D distance (
{config?.ui.unit_system == "imperial"
? "feet"
: "meters"}
)
{t(
"masksAndZones.zones.speedEstimation.lineDDistance",
{
unit:
config?.ui.unit_system == "imperial"
? t("feet", { ns: "common" })
: t("meters", { ns: "common" }),
},
)}
</FormLabel>
<FormControl>
<Input
+2 -2
View File
@@ -197,7 +197,7 @@ function ConfigEditor() {
listener = (e) => {
e.preventDefault();
e.returnValue = true;
return "Exit without saving?";
return t("confirm");
};
window.addEventListener("beforeunload", listener);
}
@@ -207,7 +207,7 @@ function ConfigEditor() {
window.removeEventListener("beforeunload", listener);
}
};
}, [hasChanges]);
}, [hasChanges, t]);
if (!config) {
return <ActivityIndicator />;
+1 -1
View File
@@ -1044,7 +1044,7 @@ function FaceGrid({
return (
<div className="absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center justify-center text-center">
<LuFolderCheck className="size-16" />
No faces available
(t("nofaces"))
</div>
);
}