fix(loyalty): translate category names in transaction history
Some checks failed
CI / ruff (push) Successful in 15s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

Category names in transaction tables now resolve to the current
page language instead of always showing English. Updated:
- category_service.validate_category_for_store: accepts lang param,
  uses get_translated_name()
- Store transactions list route: passes request.state.language
- Card detail transactions route: passes request.state.language
- card_service.get_customer_transactions_with_store_names: accepts
  lang param for storefront route

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 14:17:43 +02:00
parent 10e37e749b
commit 255ac6525e
3 changed files with 29 additions and 9 deletions

View File

@@ -807,6 +807,7 @@ class CardService:
*,
skip: int = 0,
limit: int = 20,
lang: str = "en",
) -> tuple[list[dict], int]:
"""
Get transaction history for a card with store names resolved.
@@ -853,7 +854,7 @@ class CardService:
names = []
for cid in tx.category_ids:
name = category_service.validate_category_for_store(
db, cid, tx.store_id or 0
db, cid, tx.store_id or 0, lang=lang
)
if name:
names.append(name)