Commit 0b02012c authored by ThinhNC's avatar ThinhNC

feat(i18n): localize account handover OTP prompt in English and Vietnamese

parent 3c4a1811
...@@ -2464,7 +2464,11 @@ ...@@ -2464,7 +2464,11 @@
"cancelTransfer": "Cancel Handover", "cancelTransfer": "Cancel Handover",
"cancelled": "Handover session cancelled", "cancelled": "Handover session cancelled",
"targetConnected": "New Account Connected!", "targetConnected": "New Account Connected!",
"targetUserDefault": "New Zalo user",
"otpAuthNotice": "Two-way Mutual Authorization:", "otpAuthNotice": "Two-way Mutual Authorization:",
"otpPromptDescription": "A 6-digit OTP verification code has been sent to {{email}}. Please enter the code to authorize transferring all data to account {{targetName}}.",
"otpPromptDefault": "Please enter the 6-digit OTP code to authorize the account ownership transfer.",
"targetUserFallback": "new account",
"otpEmailSentTitle": "OTP Sent to Email", "otpEmailSentTitle": "OTP Sent to Email",
"otpEmailSentDesc": "Check your inbox (or Spam/Junk folder) of:", "otpEmailSentDesc": "Check your inbox (or Spam/Junk folder) of:",
"otpInputLabel": "OTP Authorization Code (6 digits)", "otpInputLabel": "OTP Authorization Code (6 digits)",
......
...@@ -2565,7 +2565,11 @@ ...@@ -2565,7 +2565,11 @@
"cancelTransfer": "Hủy Phiên Chuyển Giao", "cancelTransfer": "Hủy Phiên Chuyển Giao",
"cancelled": "Đã hủy phiên chuyển giao", "cancelled": "Đã hủy phiên chuyển giao",
"targetConnected": "Tài Khoản Mới Đã Kết Nối!", "targetConnected": "Tài Khoản Mới Đã Kết Nối!",
"targetUserDefault": "Người dùng Zalo mới",
"otpAuthNotice": "Xác thực bảo mật 2 chiều:", "otpAuthNotice": "Xác thực bảo mật 2 chiều:",
"otpPromptDescription": "Mã xác thực OTP gồm 6 chữ số đã được gửi đến email {{email}}. Vui lòng nhập mã để xác nhận chuyển toàn bộ dữ liệu sang tài khoản {{targetName}}.",
"otpPromptDefault": "Vui lòng nhập mã OTP gồm 6 chữ số để ký duyệt lệnh chuyển giao quyền sở hữu.",
"targetUserFallback": "mới",
"otpEmailSentTitle": "Đã gửi mã OTP qua Email", "otpEmailSentTitle": "Đã gửi mã OTP qua Email",
"otpEmailSentDesc": "Kiểm tra hộp thư đến (hoặc hòm thư Rác/Spam) của:", "otpEmailSentDesc": "Kiểm tra hộp thư đến (hoặc hòm thư Rác/Spam) của:",
"otpInputLabel": "Mã xác thực OTP (6 chữ số)", "otpInputLabel": "Mã xác thực OTP (6 chữ số)",
......
...@@ -57,6 +57,7 @@ export const AccountHandoverPage: React.FC = () => { ...@@ -57,6 +57,7 @@ export const AccountHandoverPage: React.FC = () => {
const [targetUserName, setTargetUserName] = useState<string>(""); const [targetUserName, setTargetUserName] = useState<string>("");
const [otpPrompt, setOtpPrompt] = useState<string>(""); const [otpPrompt, setOtpPrompt] = useState<string>("");
const [otpDevCode, setOtpDevCode] = useState<string>(""); const [otpDevCode, setOtpDevCode] = useState<string>("");
const [maskedEmail, setMaskedEmail] = useState<string>("");
const [otpInput, setOtpInput] = useState<string>(""); const [otpInput, setOtpInput] = useState<string>("");
const [senderTimeLeft, setSenderTimeLeft] = useState<number>(900); const [senderTimeLeft, setSenderTimeLeft] = useState<number>(900);
const [isInitiating, setIsInitiating] = useState<boolean>(false); const [isInitiating, setIsInitiating] = useState<boolean>(false);
...@@ -162,6 +163,12 @@ export const AccountHandoverPage: React.FC = () => { ...@@ -162,6 +163,12 @@ export const AccountHandoverPage: React.FC = () => {
if (statusRes.targetUserName) setTargetUserName(statusRes.targetUserName); if (statusRes.targetUserName) setTargetUserName(statusRes.targetUserName);
if (statusRes.otpPrompt) setOtpPrompt(statusRes.otpPrompt); if (statusRes.otpPrompt) setOtpPrompt(statusRes.otpPrompt);
if (statusRes.otpCodeDev) setOtpDevCode(statusRes.otpCodeDev); if (statusRes.otpCodeDev) setOtpDevCode(statusRes.otpCodeDev);
if (statusRes.sourceUserEmailMasked) {
setMaskedEmail(statusRes.sourceUserEmailMasked);
} else if (statusRes.otpPrompt) {
const emailMatch = statusRes.otpPrompt.match(/email\s+([^\s,]+)/i);
if (emailMatch?.[1]) setMaskedEmail(emailMatch[1]);
}
} else if (statusRes.status === "EXPIRED") { } else if (statusRes.status === "EXPIRED") {
setSenderStatus("EXPIRED"); setSenderStatus("EXPIRED");
} }
...@@ -222,6 +229,7 @@ export const AccountHandoverPage: React.FC = () => { ...@@ -222,6 +229,7 @@ export const AccountHandoverPage: React.FC = () => {
setSenderStatus("IDLE"); setSenderStatus("IDLE");
setInitiateData(null); setInitiateData(null);
setOtpInput(""); setOtpInput("");
setMaskedEmail("");
openSnackbar({ openSnackbar({
type: "info", type: "info",
text: t("handover.cancelled") || "Đã hủy phiên chuyển giao", text: t("handover.cancelled") || "Đã hủy phiên chuyển giao",
...@@ -604,7 +612,7 @@ export const AccountHandoverPage: React.FC = () => { ...@@ -604,7 +612,7 @@ export const AccountHandoverPage: React.FC = () => {
{t("handover.targetConnected") || "Tài Khoản Mới Đã Kết Nối!"} {t("handover.targetConnected") || "Tài Khoản Mới Đã Kết Nối!"}
</span> </span>
<span className="font-baloo font-bold text-sm sm:text-base text-clay-text block"> <span className="font-baloo font-bold text-sm sm:text-base text-clay-text block">
{targetUserName || "Người dùng Zalo mới"} {targetUserName?.trim() || t("handover.targetUserDefault") || "Người dùng Zalo mới"}
</span> </span>
</div> </div>
</div> </div>
...@@ -617,8 +625,13 @@ export const AccountHandoverPage: React.FC = () => { ...@@ -617,8 +625,13 @@ export const AccountHandoverPage: React.FC = () => {
{t("handover.otpAuthNotice") || "Xác thực bảo mật 2 chiều:"} {t("handover.otpAuthNotice") || "Xác thực bảo mật 2 chiều:"}
</span> </span>
<span> <span>
{otpPrompt || {maskedEmail
"Vui lòng nhập mã OTP gồm 6 chữ số để ký duyệt lệnh chuyển giao quyền sở hữu."} ? t("handover.otpPromptDescription", {
email: maskedEmail,
targetName: targetUserName?.trim() || t("handover.targetUserFallback") || "mới",
})
: t("handover.otpPromptDefault") ||
"Vui lòng nhập mã OTP gồm 6 chữ số để ký duyệt lệnh chuyển giao quyền sở hữu."}
</span> </span>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment