diff --git a/src/pages/Proof/Reply_Public/ProofForm.js b/src/pages/Proof/Reply_Public/ProofForm.js index 4041777..7c6c05a 100644 --- a/src/pages/Proof/Reply_Public/ProofForm.js +++ b/src/pages/Proof/Reply_Public/ProofForm.js @@ -59,7 +59,7 @@ const FormPanel = ({ formData }) => { onSubmit: values => { if (!actionValue) { if (!attachments || attachments.length <= 0) { - setWarningText("請選擇上傳檔案"); + setWarningText(intl.formatMessage({id: 'requireFile'})); setIsWarningPopUp(true); return; } @@ -109,7 +109,7 @@ const FormPanel = ({ formData }) => { let file = event.target.files[0]; if (file) { if (!file.name.toLowerCase().substr(file.name.length - 4).includes(".pdf")) { - setWarningText("請上傳有效檔案 (檔案格式: .pdf)"); + setWarningText(intl.formatMessage({id: 'requireValidFileWithPdfFormat'})); setIsWarningPopUp(true); document.getElementById("uploadFileBtn").value = ""; return; diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 1ecf631..4f5f4c5 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -54,25 +54,25 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { enableReinitialize: true, initialValues: loadedData, validationSchema: yup.object().shape({ - contactPerson: yup.string().max(40, "不得超過 40 個字符").required(intl.formatMessage({id: 'requireContactPerson'})), + contactPerson: yup.string().max(40, intl.formatMessage({id: 'noMoreThen40Words'})).required(intl.formatMessage({id: 'requireContactPerson'})), tel_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})).required(intl.formatMessage({id: 'requireDialingCode'})), fax_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})), phoneNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).required(intl.formatMessage({id: 'requireContactNumber'})), faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})), - remarks: yup.string().max(255, "不得超過 255 個字符").nullable(), + remarks: yup.string().max(255,intl.formatMessage({id: 'noMoreThen255Words'})).nullable(), }), onSubmit: values => { if (!values.issueId) { - setWarningText("請選擇目標期數"); + setWarningText(intl.formatMessage({id: 'requireTargetVol'})); setIsWarningPopUp(true); return; } if (!attachment) { - setWarningText("請選擇上傳檔案"); + setWarningText(intl.formatMessage({id: 'requireFile'})); setIsWarningPopUp(true); return; } else if (!attachment.size || attachment.size <= 0) { - setWarningText("請上傳有效檔案"); + setWarningText(intl.formatMessage({id: 'requireValidFile'})); setIsWarningPopUp(true); return; } else if (attachment.size >= (10 * 1024 * 1034)) { @@ -99,7 +99,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { }, files: [attachment], onSuccess: function () { - notifyActionSuccess('申請提交成功!') + notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') navigate("/publicNotice"); // location.reload(); } @@ -117,7 +117,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { ) { setAttachment(event.target.files[0]); } else { - setWarningText("請上傳有效檔案 (檔案格式: .doc, .docx, .xls, .xlsx)"); + setWarningText(intl.formatMessage({id: 'requireValidFileWithFormat'})); setIsWarningPopUp(true); setAttachment({}); document.getElementById("uploadFileBtn").value = ""; @@ -184,7 +184,9 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { - 目標期數: + + : + { - ({"檔案大小應<10MB"}): + ({intl.formatMessage({id: 'fileSizeWarning'})}): @@ -231,7 +233,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { component="span" variant="outlined" size="large" - >{attachment ? "上傳檔案" : "重新上傳"} + >{attachment ? intl.formatMessage({id: 'uploadFileBtn'}) : intl.formatMessage({id: 'reUpload'})} diff --git a/src/translations/en.json b/src/translations/en.json index 0c9ca7d..a8b6a44 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -17,6 +17,17 @@ "payLater": "Pay later", "backToNoticePage": "Return to \"My Public Notices\"", "pleaseClickToPay": "Please click below to complete the payment", + "targetVol": "Target volume", + "requireTargetVol": "Please select the target volume", + "uploadFileBtn": "Upload file", + "reUpload": "Re-upload", + "requireFile": "Please select a file to upload", + "requireValidFile": "Please upload a valid file", + "requireValidFileWithPdfFormat": "Please upload a valid file (file format: .pdf)", + "requireValidFileWithFormat": "Please upload a valid file (file format: .doc, .docx, .xls, .xlsx)", + "submissionSuccess": "Application submitted successfully", + "noMoreThen40Words": "Must not exceed 40 characters", + "noMoreThen255Words": "Must not exceed 255 characters", "registerTitle1": "Become", "registerTitle2": "Gazette Notice", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 6520e71..d3fee84 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -17,6 +17,17 @@ "payLater": "稍后缴费", "backToNoticePage": "返回「我的公共启事」", "pleaseClickToPay": "请按以下完成缴费", + "targetVol": "目标期数", + "requireTargetVol": "请选择目标期数", + "uploadFileBtn": "上传档案", + "reUpload": "重新上传", + "requireFile": "请选择上传档案", + "requireValidFile": "请上传有效档案", + "requireValidFileWithPdfFormat": "请上传有效档案 (档案格式: .pdf)", + "requireValidFileWithFormat": "请上传有效档案 (档案格式: .doc, .docx, .xls, .xlsx)", + "submissionSuccess": "申请提交成功", + "noMoreThen40Words": "不得超过 40 个字符", + "noMoreThen255Words": "不得超过 255 个字符", "registerTitle1": "立即成为", "registerTitle2": "宪报刊登公告", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 0296c0f..f82c33c 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -17,6 +17,17 @@ "payLater": "稍後繳費", "backToNoticePage": "返回「我的公共啟事」", "pleaseClickToPay": "請按以下完成繳費", + "targetVol": "目標期數", + "requireTargetVol": "請選擇目標期數", + "uploadFileBtn": "上傳檔案", + "reUpload": "重新上傳", + "requireFile": "請選擇上傳檔案", + "requireValidFile": "請上傳有效檔案", + "requireValidFileWithPdfFormat": "請上傳有效檔案 (檔案格式: .pdf)", + "requireValidFileWithFormat": "請上傳有效檔案 (檔案格式: .doc, .docx, .xls, .xlsx)", + "submissionSuccess": "申請提交成功", + "noMoreThen40Words": "不得超過 40 個字符", + "noMoreThen255Words": "不得超過 255 個字符", "registerTitle1": "立即成為", "registerTitle2": "憲報刊登公告",