Commit a3b34f95 authored by ThinhNC's avatar ThinhNC

fix(ocr): add bilingual i18n support for guest demo receipt warning

parent d4793d80
......@@ -1538,6 +1538,7 @@
"itemCount": "{{count}} items",
"warnings": "AI Warnings",
"defaultWarning": "Please verify extracted values against the original receipt before creating a transaction.",
"guestDemoWarning": "Sample receipt simulated in Demo Mode (processed 100% locally, no real AI tokens consumed).",
"confirmTransaction": "Confirm Create Transaction",
"confirmHint": "Pre-fill this extracted receipt data into a new Transaction",
"reScan": "Scan Another Receipt"
......
......@@ -1639,6 +1639,7 @@
"itemCount": "{{count}} món",
"warnings": "Cảnh báo từ AI",
"defaultWarning": "Vui lòng đối chiếu các giá trị đã trích xuất với hóa đơn gốc trước khi tạo giao dịch.",
"guestDemoWarning": "Hóa đơn mẫu mô phỏng trong Chế độ Dùng thử (100% xử lý tại máy, không tốn token AI thật).",
"confirmTransaction": "Xác nhận tạo Giao dịch",
"confirmHint": "Tự động điền dữ liệu hóa đơn này vào Form tạo giao dịch mới",
"reScan": "Quét hóa đơn khác"
......
......@@ -175,9 +175,21 @@ export const ReceiptScannerView: React.FC<ReceiptScannerViewProps> = ({ onTransa
const trimmed = warn.trim();
const standardEn = "please verify extracted values against the original receipt before creating a transaction.";
const standardVi = "vui lòng đối chiếu các giá trị đã trích xuất với hóa đơn gốc trước khi tạo giao dịch.";
if (trimmed.toLowerCase() === standardEn || trimmed.toLowerCase() === standardVi) {
const demoVi = "hóa đơn mẫu mô phỏng trong chế độ dùng thử (100% xử lý tại máy, không tốn token ai thật).";
const demoEn = "sample receipt simulated in demo mode (processed 100% locally, no real ai tokens consumed).";
const lower = trimmed.toLowerCase();
if (lower === standardEn || lower === standardVi) {
return t("ai.ocr.defaultWarning");
}
if (
lower === demoVi ||
lower === demoEn ||
lower.includes("hóa đơn mẫu mô phỏng trong chế độ dùng thử") ||
lower.includes("sample receipt simulated in demo mode")
) {
return t("ai.ocr.guestDemoWarning");
}
return trimmed;
};
......
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