mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-16 02:23:02 +03:00
bump react-i18next to 18 and fix i18next 27 types
react-i18next 18 peers i18next >= 27.0.1, so the two move together. i18next 27's TFunction no longer fits the hand-written t signatures in the config form, and it rejects undefined as the options argument.
This commit is contained in:
@@ -56,7 +56,7 @@ export function ConfigFieldMessage({
|
||||
<SeverityIcon severity={severity} />
|
||||
<AlertDescription>
|
||||
<div className="flex flex-col gap-1">
|
||||
<span>{t(messageKey, values)}</span>
|
||||
<span>{t(messageKey, values ?? {})}</span>
|
||||
{docLink && (
|
||||
<Link
|
||||
to={getLocaleDocUrl(docLink)}
|
||||
|
||||
@@ -44,7 +44,9 @@ export function ConfigMessageBanner({ messages }: ConfigMessageBannerProps) {
|
||||
className="flex items-center [&>svg+div]:translate-y-0 [&>svg]:static [&>svg~*]:pl-2"
|
||||
>
|
||||
<SeverityIcon severity={msg.severity} />
|
||||
<AlertDescription>{t(msg.messageKey, msg.values)}</AlertDescription>
|
||||
<AlertDescription>
|
||||
{t(msg.messageKey, msg.values ?? {})}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import type {
|
||||
} from "@rjsf/utils";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { LuCircleAlert } from "react-icons/lu";
|
||||
import type { TFunction } from "i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
buildTranslationPath,
|
||||
@@ -93,7 +94,7 @@ const resolveErrorFieldLabel = ({
|
||||
error: RJSFValidationError;
|
||||
schema: RJSFSchema | undefined;
|
||||
formContext?: ConfigFormContext;
|
||||
t: (key: string, options?: Record<string, unknown>) => string;
|
||||
t: TFunction;
|
||||
i18n: ReturnType<typeof useTranslation>["i18n"];
|
||||
}): string | undefined => {
|
||||
const segments = parsePropertyPath(error.property || "");
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* for RJSF form fields.
|
||||
*/
|
||||
|
||||
import type { TFunction } from "i18next";
|
||||
import type { ConfigFormContext } from "@/types/configForm";
|
||||
import { getEffectiveAttributeLabels } from "@/utils/configUtil";
|
||||
|
||||
@@ -70,13 +71,13 @@ export function buildTranslationPath(
|
||||
*/
|
||||
export function resolveConfigTranslation(
|
||||
i18n: { exists: (key: string, opts?: Record<string, unknown>) => boolean },
|
||||
t: (key: string, opts?: Record<string, unknown>) => string,
|
||||
t: TFunction,
|
||||
translationPath: string,
|
||||
suffix: "label" | "description",
|
||||
sectionI18nPrefix?: string,
|
||||
ns?: string,
|
||||
): string | undefined {
|
||||
const opts = ns ? { ns } : undefined;
|
||||
const opts = ns ? { ns } : {};
|
||||
|
||||
if (
|
||||
sectionI18nPrefix &&
|
||||
|
||||
Reference in New Issue
Block a user