feat(backend): error codes, backend i18n (en/el) and language fields
Platform v2 step 1.2 (APPS_PLATFORM D-12, §3.2, §8).
- core/errors.py: XeniaError + CODES registry; handlers give every error the
{"error": {code, params, message}, "detail"} shape: XeniaError, wrapped
HTTPException (http.<status>, detail untouched), validation.invalid (FastAPI
detail list kept), and internal.error 500 with the request id (body, header
and log line)
- orders: the 18 "Order not found" raises -> XeniaError("order.not_found")
- core/i18n: t(key, lang, **params) with en/el JSON (en fallback), venue/zone/
user language resolution, normalize_language; 56 print keys
- printer_service: every printed label goes through keys. Kitchen,
cancellation and service-item tickets print in the prep zone's language
(-> venue.language); reports/receipts/synopsis in venue.language. Greek
output is unchanged. Print retries now pass the job's zone (language and
item grouping were lost on retries)
- users.language, prep_zones.language (revision 0003), setting venue.language
(default en); editable via PATCH /auth/me, staff update, prep zones API;
"" = inherit
- tests: error shapes, key/placeholder parity, fallback, kitchen ticket per
zone/venue language, language APIs; pack rule CS-12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"print": {
|
||||
"aligned": {
|
||||
"order": "Order: #{value}",
|
||||
"table": "Table: {value}",
|
||||
"time": "Time: {value}"
|
||||
},
|
||||
"cancel": {
|
||||
"banner": "*** CANCELLED ***"
|
||||
},
|
||||
"receipt": {
|
||||
"closed": "Closed: {value}",
|
||||
"opened": "Opened: {value}",
|
||||
"order_title": "ORDER #{value}"
|
||||
},
|
||||
"report": {
|
||||
"avg_duration": "Avg. duration: {minutes:.0f} min",
|
||||
"categories_title": "CATEGORY REPORT",
|
||||
"details": "DETAILS",
|
||||
"from": "From: {value}",
|
||||
"grand_total": "ALL PRINTERS",
|
||||
"items": "Items: {value}",
|
||||
"orders": "Orders: {value}",
|
||||
"pct_revenue": "% revenue",
|
||||
"pct_units": "% units",
|
||||
"period": "Period: {value}",
|
||||
"prep_zone_title": "PREP ZONE",
|
||||
"print_jobs": "Print jobs: {value}",
|
||||
"printer": "Printer: {value}",
|
||||
"printer_title": "PRINTER REPORT",
|
||||
"product_breakdown": "PRODUCT BREAKDOWN",
|
||||
"product_shares": "{revenue:.2f}e | {rev}% rev. {qty}% qty",
|
||||
"products_full_title": "FULL PRODUCT BREAKDOWN",
|
||||
"products_title": "PRODUCT REPORT",
|
||||
"qty_units": "{value} pcs",
|
||||
"revenue": "Revenue",
|
||||
"table": "Table: {value}",
|
||||
"table_orders_avg": "{count} ord. / avg {avg:.2f}e",
|
||||
"tables_title": "TABLE REPORT",
|
||||
"to": "To: {value}",
|
||||
"total": "TOTAL: {value:.2f}e",
|
||||
"total_items": "Total items: {value}",
|
||||
"total_qty": "Total qty: {value}",
|
||||
"units": "Units",
|
||||
"value": "Value: {value:.2f}e",
|
||||
"value_caps": "VALUE: {value:.2f}e",
|
||||
"waiter": "Waiter: {value}",
|
||||
"waiter_title": "WAITER REPORT",
|
||||
"workday": "Workday: {value}"
|
||||
},
|
||||
"synopsis": {
|
||||
"paid": "PAID:",
|
||||
"paid_total": "Paid: {value:.2f}e",
|
||||
"pending": "PENDING:",
|
||||
"remaining": "Remaining: {value:.2f}e",
|
||||
"title": "ORDER SUMMARY"
|
||||
},
|
||||
"ticket": {
|
||||
"compact_guests": " | {count}pax",
|
||||
"compact_header": "Ord. #{order} | Tbl {table} | {time} | {waiter}",
|
||||
"date_label": "Date:",
|
||||
"end": "End of order",
|
||||
"guests_label": "Guests:",
|
||||
"note": "Note: {note}",
|
||||
"order_title": "Order #{order}",
|
||||
"table_label": "Table:",
|
||||
"table_value": "Table {table}",
|
||||
"waiter_label": "Waiter:",
|
||||
"without": "NO:"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user