From cbb4c7fe0b94459162ad5e998bc05cd293e0ff96 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 11 Aug 2025 09:02:00 +0000 Subject: (대표님) 입찰, EDP 변경사항 대응, spreadJS 오류 수정, 벤더실사 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/form-data/var-list-download-btn.tsx | 28 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'components/form-data/var-list-download-btn.tsx') diff --git a/components/form-data/var-list-download-btn.tsx b/components/form-data/var-list-download-btn.tsx index bbadf893..9d09ab8c 100644 --- a/components/form-data/var-list-download-btn.tsx +++ b/components/form-data/var-list-download-btn.tsx @@ -8,6 +8,8 @@ import ExcelJS from "exceljs"; import { saveAs } from "file-saver"; import { Button } from "@/components/ui/button"; import { DataTableColumnJSON } from "./form-data-table-columns"; +import { useParams } from "next/navigation"; +import { useTranslation } from "@/i18n/client"; interface VarListDownloadBtnProps { columnsJSON: DataTableColumnJSON[]; @@ -19,6 +21,10 @@ export const VarListDownloadBtn: FC = ({ formCode, }) => { const { toast } = useToast(); + + const params = useParams(); + const lng = (params?.lng as string) || "ko"; + const { t } = useTranslation(lng, "engineering"); const downloadReportVarList = async () => { try { @@ -33,7 +39,10 @@ export const VarListDownloadBtn: FC = ({ validationSheet.state = "hidden"; // 시트 숨김 처리 // 1. 데이터 시트에 헤더 추가 - const headers = ["Table Column Label", "Report Variable"]; + const headers = [ + t("varListDownload.headers.tableColumnLabel"), + t("varListDownload.headers.reportVariable") + ]; worksheet.addRow(headers); // 헤더 스타일 적용 @@ -50,7 +59,7 @@ export const VarListDownloadBtn: FC = ({ // 2. 데이터 행 추가 columnsJSON.forEach((row) => { - console.log(row) + console.log(row); const { displayLabel, key } = row; // const labelConvert = label.replaceAll(" ", "_"); @@ -81,13 +90,14 @@ export const VarListDownloadBtn: FC = ({ }); const buffer = await workbook.xlsx.writeBuffer(); - saveAs(new Blob([buffer]), `${formCode}_report_varible_list.xlsx`); - toastMessage.success("Report Varible List File 다운로드 완료!"); + const fileName = `${formCode}${t("varListDownload.fileNameSuffix")}`; + saveAs(new Blob([buffer]), fileName); + toastMessage.success(t("varListDownload.messages.downloadComplete")); } catch (err) { console.log(err); toast({ - title: "Error", - description: "Variable List 파일을 찾을 수가 없습니다.", + title: t("varListDownload.messages.errorTitle"), + description: t("varListDownload.messages.errorDescription"), variant: "destructive", }); } @@ -97,16 +107,16 @@ export const VarListDownloadBtn: FC = ({ ); }; \ No newline at end of file -- cgit v1.2.3