* `feat: added internationalization lib, added english labels` * `fixes from code review` * `feat: add crowdin github actions` * `fix: added support for i18n in testing. Fixed broken tests` * `fix: missing translations` * `removed unneded import` * `more components updated with missing translations` * `fixed lint issue` * `Refactor: updated how translations are scoped, updated all references` * `fixing broken tests` * `feat: added language switcher, updated some translations` * `fixed linting issues` * `reverting vite config` * `add english group id's to command palette` * `updated PR template for i18n`
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import { Button } from "@components/UI/Button.tsx";
|
|
import {
|
|
Dialog,
|
|
DialogClose,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
} from "@components/UI/Dialog.tsx";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export interface PkiRegenerateDialogProps {
|
|
text: {
|
|
title: string;
|
|
description: string;
|
|
button: string;
|
|
};
|
|
open: boolean;
|
|
onOpenChange: () => void;
|
|
onSubmit: () => void;
|
|
}
|
|
|
|
export const PkiRegenerateDialog = ({
|
|
text = {
|
|
title: "",
|
|
description: "",
|
|
button: "",
|
|
},
|
|
open,
|
|
onOpenChange,
|
|
onSubmit,
|
|
}: PkiRegenerateDialogProps) => {
|
|
const { t } = useTranslation("dialog");
|
|
const dialogText = {
|
|
title: text.title || t("pkiRegenerate.title"),
|
|
description: text.description ||
|
|
t("pkiRegenerate.description"),
|
|
button: text.button || t("button.regenerate"),
|
|
};
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogContent>
|
|
<DialogClose />
|
|
<DialogHeader>
|
|
<DialogTitle>{dialogText.title}</DialogTitle>
|
|
<DialogDescription>
|
|
{dialogText.description}
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
<DialogFooter>
|
|
<Button
|
|
variant="destructive"
|
|
name="regenerate"
|
|
onClick={() => onSubmit()}
|
|
>
|
|
{dialogText.button}
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
};
|