diff options
Diffstat (limited to 'components/form-data/form-data-report-dialog.tsx')
| -rw-r--r-- | components/form-data/form-data-report-dialog.tsx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/components/form-data/form-data-report-dialog.tsx b/components/form-data/form-data-report-dialog.tsx index 3cfbbeb3..c990f019 100644 --- a/components/form-data/form-data-report-dialog.tsx +++ b/components/form-data/form-data-report-dialog.tsx @@ -8,6 +8,8 @@ import React, { useEffect, useRef, } from "react"; +import { useParams } from "next/navigation"; +import { useTranslation } from "@/i18n/client"; import { WebViewerInstance } from "@pdftron/webviewer"; import { Loader2 } from "lucide-react"; import { saveAs } from "file-saver"; @@ -60,6 +62,9 @@ export const FormDataReportDialog: FC<FormDataReportDialogProps> = ({ formId, formCode, }) => { + const params = useParams(); + const lng = (params?.lng as string) || "ko"; + const { t } = useTranslation(lng, "engineering"); const [tempList, setTempList] = useState<tempFile[]>([]); const [selectTemp, setSelectTemp] = useState<string>(""); @@ -100,7 +105,7 @@ export const FormDataReportDialog: FC<FormDataReportDialogProps> = ({ saveAs(new Blob([fileData]), fileName); - toast.success("Report 다운로드 완료!"); + toast.success(t("singleReport.downloadComplete")); } }; @@ -120,7 +125,7 @@ export const FormDataReportDialog: FC<FormDataReportDialogProps> = ({ setPublishDialogOpen(true); } catch (error) { console.error("Error preparing file for publishing:", error); - toast.error("Failed to prepare document for publishing"); + toast.error(t("singleReport.publishPreparationFailed")); } } }; @@ -130,20 +135,20 @@ export const FormDataReportDialog: FC<FormDataReportDialogProps> = ({ <Dialog open={reportData.length > 0} onOpenChange={onClose}> <DialogContent className="w-[70vw]" style={{ maxWidth: "none" }}> <DialogHeader> - <DialogTitle>Create Vendor Document</DialogTitle> + <DialogTitle>{t("singleReport.dialogTitle")}</DialogTitle> <DialogDescription> - 사용하시고자 하는 Vendor Document Template를 선택하여 주시기 바랍니다. + {t("singleReport.dialogDescription")} </DialogDescription> </DialogHeader> <div className="h-[60px]"> - <Label>Vendor Document Template Select</Label> + <Label>{t("singleReport.templateSelectLabel")}</Label> <Select value={selectTemp} onValueChange={setSelectTemp} disabled={instance === null} > <SelectTrigger className="w-[100%]"> - <SelectValue placeholder="사용하시고자하는 Vendor Document Template을 선택하여 주시기 바랍니다." /> + <SelectValue placeholder={t("singleReport.templateSelectPlaceholder")} /> </SelectTrigger> <SelectContent> {tempList.map((c) => { @@ -167,6 +172,7 @@ export const FormDataReportDialog: FC<FormDataReportDialogProps> = ({ setInstance={setInstance} setFileLoading={setFileLoading} formCode={formCode} + t={t} /> </div> @@ -178,10 +184,10 @@ export const FormDataReportDialog: FC<FormDataReportDialogProps> = ({ variant="outline" className="mr-2" > - Publish + {t("singleReport.publish")} </Button> <Button onClick={downloadFileData} disabled={selectTemp.length === 0}> - Create Vendor Document + {t("singleReport.createDocument")} </Button> </DialogFooter> </DialogContent> @@ -208,6 +214,7 @@ interface ReportWebViewerProps { setInstance: Dispatch<SetStateAction<WebViewerInstance | null>>; setFileLoading: Dispatch<SetStateAction<boolean>>; formCode: string; + t: (key: string, options?: any) => string; } const ReportWebViewer: FC<ReportWebViewerProps> = ({ @@ -218,6 +225,7 @@ const ReportWebViewer: FC<ReportWebViewerProps> = ({ setInstance, setFileLoading, formCode, + t, }) => { const [viwerLoading, setViewerLoading] = useState<boolean>(true); const viewer = useRef<HTMLDivElement>(null); @@ -280,7 +288,7 @@ const ReportWebViewer: FC<ReportWebViewerProps> = ({ {viwerLoading && ( <div className="flex flex-col items-center justify-center py-12"> <Loader2 className="h-8 w-8 text-blue-500 animate-spin mb-4" /> - <p className="text-sm text-muted-foreground">문서 뷰어 로딩 중...</p> + <p className="text-sm text-muted-foreground">{t("singleReport.documentViewerLoading")}</p> </div> )} </div> |
