fix(i18n): localize API error messages by code (no more raw English)
Error toasts surfaced the raw English backend message. Added an errors namespace (fa/ar/en) keyed by error code + a useApiError() resolver that maps ApiClientError.code to the localized message (fallback to a localized generic). Wired into menu, tables, demo banner, and subscription checkout; hardened getErrorMessage so it never returns the raw backend message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,33 @@
|
||||
"saved": "Saved",
|
||||
"errorGeneric": "Something went wrong. Please try again."
|
||||
},
|
||||
"errors": {
|
||||
"generic": "Something went wrong. Please try again.",
|
||||
"REQUEST_FAILED": "Request failed. Please try again.",
|
||||
"VALIDATION_ERROR": "The information entered is invalid.",
|
||||
"FORBIDDEN": "You don't have permission to do this.",
|
||||
"OWNER_REQUIRED": "Only the café owner can do this.",
|
||||
"MANAGER_REQUIRED": "This action requires manager access.",
|
||||
"PLAN_LIMIT_REACHED": "You've reached your plan limit. Upgrade to continue.",
|
||||
"PLAN_FEATURE_DISABLED": "This feature isn't available on your current plan.",
|
||||
"NOT_FOUND": "Not found.",
|
||||
"ORDER_NOT_FOUND": "Order not found.",
|
||||
"ITEM_NOT_FOUND": "Item not found.",
|
||||
"ITEM_ALREADY_VOIDED": "This item is already voided.",
|
||||
"ORDER_ALREADY_CLOSED": "This order is already closed.",
|
||||
"TABLE_OCCUPIED": "This table is currently occupied.",
|
||||
"TABLE_CLEANING": "This table is being cleaned.",
|
||||
"TABLE_NOT_FOUND": "Table not found.",
|
||||
"TABLE_HAS_OPEN_ORDER": "This table has an open order and can't be removed.",
|
||||
"TABLE_SECTION_HAS_TABLES": "This section has tables and can't be removed.",
|
||||
"BRANCH_NOT_FOUND": "Branch not found.",
|
||||
"SECTION_NOT_FOUND": "Section not found.",
|
||||
"RATE_LIMITED": "Too many requests. Please wait a moment.",
|
||||
"SMS_FAILED": "Could not send the SMS. Please try again.",
|
||||
"INVALID_OTP": "Invalid or expired verification code.",
|
||||
"TICKET_CLOSED": "This ticket is closed and can't receive messages.",
|
||||
"ALREADY_REGISTERED": "An account already exists for this number. Please sign in."
|
||||
},
|
||||
"brand": {
|
||||
"name": "Meezi"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user