diff --git a/package.json b/package.json index 41ecd38..c90ae67 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,14 @@ "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cmdk": "^1.0.0", + "i18next": "^24.0.2", "jotai-zustand": "^0.6.0", "lucide-react": "^0.454.0", "next-themes": "^0.3.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-hook-form": "^7.53.1", + "react-i18next": "^15.1.2", "react-router-dom": "^6.27.0", "react-use-websocket": "^4.10.1", "react-virtuoso": "^4.12.0", diff --git a/src/components/action-button-group.tsx b/src/components/action-button-group.tsx index 9c9bb01..fee1faa 100644 --- a/src/components/action-button-group.tsx +++ b/src/components/action-button-group.tsx @@ -13,6 +13,8 @@ import { import { KeyedMutator } from "swr"; import { buttonVariants } from "@/components/ui/button" +import { useTranslation } from "react-i18next"; + interface ButtonGroupProps { className?: string; children: React.ReactNode; @@ -20,6 +22,7 @@ interface ButtonGroupProps { } export function ActionButtonGroup({ className, children, delete: { fn, id, mutate } }: ButtonGroupProps) { + const { t } = useTranslation(); const handleDelete = async () => { await fn([id]); await mutate(); @@ -30,18 +33,18 @@ export function ActionButtonGroup({ className, children, delete: { fn, id, {children} - + - Confirm Deletion? + {t("ConfirmDeletion")} - This operation is unrecoverable! + {t("Results.ThisOperationIsUnrecoverable")} - Cancel - Confirm + {t("Close")} + {t("Confirm")} diff --git a/src/components/alert-rule.tsx b/src/components/alert-rule.tsx index bf76c8d..e06f0db 100644 --- a/src/components/alert-rule.tsx +++ b/src/components/alert-rule.tsx @@ -43,6 +43,8 @@ import { Textarea } from "./ui/textarea" import { useNotification } from "@/hooks/useNotfication" import { Combobox } from "./ui/combobox" +import { useTranslation } from "react-i18next"; + interface AlertRuleCardProps { data?: ModelAlertRule; mutate: KeyedMutator; @@ -83,6 +85,7 @@ const alertRuleFormSchema = z.object({ }); export const AlertRuleCard: React.FC = ({ data, mutate }) => { + const { t } = useTranslation(); const form = useForm>({ resolver: zodResolver(alertRuleFormSchema), defaultValues: data ? { @@ -133,7 +136,7 @@ export const AlertRuleCard: React.FC = ({ data, mutate }) =>
- New Alert Rule + {data ? t("EditAlertRule") : t("CreateAlertRule")}
@@ -143,7 +146,7 @@ export const AlertRuleCard: React.FC = ({ data, mutate }) => name="name" render={({ field }) => ( - Name + {t("Name")} = ({ data, mutate }) => name="rules_raw" render={({ field }) => ( - Rules + {t("Rules")}