Refactor and clean up i18n (#17198)

* clean up i18n

* fix key

* fix key
This commit is contained in:
Josh Hawkins
2025-03-17 06:26:01 -06:00
committed by GitHub
parent 6e3ae0afc2
commit 03da70cb81
74 changed files with 1243 additions and 799 deletions
@@ -199,7 +199,7 @@ export default function AuthenticationView() {
<div className="mb-5 flex flex-row items-center justify-between gap-2">
<div className="flex flex-col items-start">
<Heading as="h3" className="my-2">
{t("users.management")}
{t("users.management.title")}
</Heading>
<p className="text-sm text-muted-foreground">
{t("users.management.desc")}
@@ -166,7 +166,7 @@ export default function CameraSettingsView({
updateConfig();
} else {
toast.error(
t("toast.save.error", {
t("toast.save.error.title", {
errorMessage: res.statusText,
ns: "common",
}),
@@ -182,7 +182,7 @@ export default function CameraSettingsView({
error.response?.data?.detail ||
"Unknown error";
toast.error(
t("toast.save.error", {
t("toast.save.error.title", {
errorMessage,
ns: "common",
}),
@@ -574,7 +574,7 @@ export default function CameraSettingsView({
watchedDetectionsZones.length > 0 ? (
!selectDetections ? (
<Trans
i18nKey="camera.reviewClassification.zoneObjectDetectionsTips"
i18nKey="camera.reviewClassification.zoneObjectDetectionsTips.text"
values={{
detectionsLabels,
zone: watchedDetectionsZones
@@ -162,9 +162,12 @@ export default function ClassificationSettingsView({
error.response?.data?.message ||
error.response?.data?.detail ||
"Unknown error";
toast.error(t("toast.save.error", { errorMessage, ns: "common" }), {
position: "top-center",
});
toast.error(
t("toast.save.error.title", { errorMessage, ns: "common" }),
{
position: "top-center",
},
);
})
.finally(() => {
setIsLoading(false);
@@ -319,7 +322,11 @@ export default function ClassificationSettingsView({
className="cursor-pointer"
value={size}
>
{t("classification.semanticSearch.modelSize." + size)}
{t(
"classification.semanticSearch.modelSize." +
size +
".title",
)}
</SelectItem>
))}
</SelectGroup>
+6 -4
View File
@@ -502,7 +502,7 @@ export default function MasksAndZonesView({
</HoverCardTrigger>
<HoverCardContent>
<div className="my-2 flex flex-col gap-2 text-sm text-primary-variant">
<p>{t("masksAndZones.zones.desc")}</p>
<p>{t("masksAndZones.zones.desc.title")}</p>
<div className="flex items-center text-primary">
<Link
to="https://docs.frigate.video/configuration/zones"
@@ -568,7 +568,7 @@ export default function MasksAndZonesView({
</HoverCardTrigger>
<HoverCardContent>
<div className="my-2 flex flex-col gap-2 text-sm text-primary-variant">
<p>{t("masksAndZones.motionMasks.desc")}</p>
<p>{t("masksAndZones.motionMasks.desc.title")}</p>
<div className="flex items-center text-primary">
<Link
to="https://docs.frigate.video/configuration/masks#motion-masks"
@@ -638,7 +638,7 @@ export default function MasksAndZonesView({
</HoverCardTrigger>
<HoverCardContent>
<div className="my-2 flex flex-col gap-2 text-sm text-primary-variant">
<p>{t("masksAndZones.objectMasks.desc")}</p>
<p>{t("masksAndZones.objectMasks.desc.title")}</p>
<div className="flex items-center text-primary">
<Link
to="https://docs.frigate.video/configuration/masks#object-filter-masks"
@@ -646,7 +646,9 @@ export default function MasksAndZonesView({
rel="noopener noreferrer"
className="inline"
>
{t("masksAndZones.objectMasks.documentation")}{" "}
{t(
"masksAndZones.objectMasks.desc.documentation",
)}{" "}
<LuExternalLink className="ml-2 inline-flex size-3" />
</Link>
</div>
+6 -6
View File
@@ -126,7 +126,7 @@ export default function MotionTunerView({
updateConfig();
} else {
toast.error(
t("toast.save.error", {
t("toast.save.error.title", {
errorMessage: res.statusText,
ns: "common",
}),
@@ -138,7 +138,7 @@ export default function MotionTunerView({
})
.catch((error) => {
toast.error(
t("toast.save.error", {
t("toast.save.error.title", {
errorMessage: error.response.data.message,
ns: "common",
}),
@@ -194,7 +194,7 @@ export default function MotionTunerView({
{t("motionDetectionTuner.title")}
</Heading>
<div className="my-3 space-y-3 text-sm text-muted-foreground">
<p>{t("motionDetectionTuner.desc")}</p>
<p>{t("motionDetectionTuner.desc.title")}</p>
<div className="flex items-center text-primary">
<Link
@@ -213,7 +213,7 @@ export default function MotionTunerView({
<div className="mt-2 space-y-6">
<div className="space-y-0.5">
<Label htmlFor="motion-threshold" className="text-md">
{t("motionDetectionTuner.Threshold")}
{t("motionDetectionTuner.Threshold.title")}
</Label>
<div className="my-2 text-sm text-muted-foreground">
<Trans ns="views/settings">
@@ -242,7 +242,7 @@ export default function MotionTunerView({
<div className="mt-2 space-y-6">
<div className="space-y-0.5">
<Label htmlFor="motion-threshold" className="text-md">
{t("motionDetectionTuner.contourArea")}
{t("motionDetectionTuner.contourArea.title")}
</Label>
<div className="my-2 text-sm text-muted-foreground">
<p>
@@ -274,7 +274,7 @@ export default function MotionTunerView({
<div className="flex flex-row items-center justify-between">
<div className="space-y-0.5">
<Label htmlFor="improve-contrast">
{t("motionDetectionTuner.improveContrast")}
{t("motionDetectionTuner.improveContrast.title")}
</Label>
<div className="text-sm text-muted-foreground">
<Trans ns="views/settings">
@@ -264,7 +264,7 @@ export default function NotificationView({
updateConfig();
} else {
toast.error(
t("toast.save.error", {
t("toast.save.error.title", {
errorMessage: res.statusText,
ns: "common",
}),
@@ -279,9 +279,12 @@ export default function NotificationView({
error.response?.data?.message ||
error.response?.data?.detail ||
"Unknown error";
toast.error(t("toast.save.error", { errorMessage, ns: "common" }), {
position: "top-center",
});
toast.error(
t("toast.save.error.title", { errorMessage, ns: "common" }),
{
position: "top-center",
},
);
})
.finally(() => {
setIsLoading(false);
@@ -389,7 +392,7 @@ export default function NotificationView({
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>{t("notification.email")}</FormLabel>
<FormLabel>{t("notification.email.title")}</FormLabel>
<FormControl>
<Input
className="text-md w-full border border-input bg-background p-2 hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark] md:w-72"
@@ -414,7 +417,7 @@ export default function NotificationView({
<>
<div className="mb-2">
<FormLabel className="flex flex-row items-center text-base">
{t("notification.cameras")}
{t("notification.cameras.title")}
</FormLabel>
</div>
<div className="max-w-md space-y-2 rounded-lg bg-secondary p-4">
@@ -423,7 +426,7 @@ export default function NotificationView({
name="allEnabled"
render={({ field }) => (
<FilterSwitch
label={t("cameras.all", {
label={t("cameras.all.title", {
ns: "components/filter",
})}
isChecked={field.value}
@@ -514,7 +517,7 @@ export default function NotificationView({
{t("notification.deviceSpecific")}
</Heading>
<Button
aria-label="Register or unregister notifications for this device"
aria-label={t("notification.registerDevice")}
disabled={
!config?.notifications.enabled || publicKey == undefined
}
@@ -653,7 +656,7 @@ export function CameraNotificationSwitch({
strftime_fmt:
config?.ui.time_format == "24hour"
? t("time.formattedTimestampExcludeSeconds.24hour", { ns: "common" })
: t("time.formattedTimestampExcludeSeconds", { ns: "common" }),
: t("time.formattedTimestampExcludeSeconds.12hour", { ns: "common" }),
});
return t("time.untilForTime", { ns: "common", time });
};
@@ -709,10 +712,10 @@ export function CameraNotificationSwitch({
{t("notification.suspendTime.1hour")}
</SelectItem>
<SelectItem value="840">
{t("notification.suspendTime.12hour")}
{t("notification.suspendTime.12hours")}
</SelectItem>
<SelectItem value="1440">
{t("notification.suspendTime.24hour")}
{t("notification.suspendTime.24hours")}
</SelectItem>
<SelectItem value="off">
{t("notification.suspendTime.untilRestart")}