feat(menu): the menu in English and Greek (platform-v2 step 6.4, D-29)

- products.translations / categories.translations (Alembic 0033, core/menu_languages.py: el + en,
  name / description / quick options by their base name; catalog.translation). Empty = the text
  as typed; no machine translation (owner).
- In the manager's product editor ("In English" / "In Greek", quick extras), the category dialog,
  and a menu board's Language (signage MenuContent.language).
- Customer screens only: cloud snapshot names / descriptions per language (C-2), the menu tablet's
  EL / EN switch the names (localize), signage boards; tickets, KDS, counter, phones keep the base.
- Catalogue bundles carry translations; @xenia/access menuLanguages.js (a backend test compares).
- e2e: manager (the other language saved), menu tablet (EN / EL names), QR table (English on
  the menu, the base name on the kitchen's order, Greek page as typed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 10:47:03 +02:00
co-authored by Claude Opus 5.5
parent 5048f82a4c
commit e395d99704
32 changed files with 459 additions and 38 deletions
+9 -1
View File
@@ -1,6 +1,6 @@
from core.timeutil import venue_date, utcnow
import json
from core import allergens, sales_points
from core import allergens, menu_languages, sales_points
from datetime import datetime, timezone
from fastapi import APIRouter, Depends
from fastapi.responses import JSONResponse
@@ -61,6 +61,7 @@ def _serialize_product(p: Product) -> dict:
"lifecycle_status": p.lifecycle_status, "sort_order": p.sort_order,
"sold_at": sales_points.sold_at(p),
"allergens": allergens.of(p),
"translations": menu_languages.of(p),
"quick_options": quick_options, "options": options,
"ingredients": ingredients, "preference_sets": preference_sets,
}
@@ -77,6 +78,7 @@ def _serialize_category(cat: Category) -> dict:
"name": cat.name, "color": cat.color, "sort_order": cat.sort_order,
"parent_name": cat.parent.name if cat.parent else None,
"general_sort_order": cat.general_sort_order, "auto_expanded": cat.auto_expanded,
"translations": menu_languages.of(cat),
"products": products,
}
@@ -165,6 +167,8 @@ def import_catalog(payload: dict, db: Session = Depends(get_db), user: User = De
existing.sort_order = cat_data.get("sort_order", 0)
existing.general_sort_order = cat_data.get("general_sort_order", 0)
existing.auto_expanded = cat_data.get("auto_expanded", False)
if "translations" in cat_data: # 6.4; older bundles: unchanged
existing.translations = menu_languages.dump(menu_languages.normalize_category(cat_data["translations"]))
db.flush()
return existing
else:
@@ -175,6 +179,7 @@ def import_catalog(payload: dict, db: Session = Depends(get_db), user: User = De
parent_id=parent_id,
general_sort_order=cat_data.get("general_sort_order", 0),
auto_expanded=cat_data.get("auto_expanded", False),
translations=menu_languages.dump(menu_languages.normalize_category(cat_data.get("translations"))),
)
db.add(cat)
db.flush()
@@ -191,6 +196,8 @@ def import_catalog(payload: dict, db: Session = Depends(get_db), user: User = De
existing.sold_at = sales_points.dump(prod_data["sold_at"])
if "allergens" in prod_data: # 6.3; older bundles: unchanged
existing.allergens = allergens.dump(prod_data["allergens"])
if "translations" in prod_data: # 6.4
existing.translations = menu_languages.dump(menu_languages.normalize_product(prod_data["translations"]))
db.flush()
product = existing
else:
@@ -202,6 +209,7 @@ def import_catalog(payload: dict, db: Session = Depends(get_db), user: User = De
sort_order=prod_data.get("sort_order", 0),
sold_at=sales_points.dump(prod_data.get("sold_at", sales_points.ALL)),
allergens=allergens.dump(prod_data.get("allergens")),
translations=menu_languages.dump(menu_languages.normalize_product(prod_data.get("translations"))),
)
db.add(product)
db.flush()