From e5a3b7bccedef8b8bbd0c69d73bcf68adbe5b538 Mon Sep 17 00:00:00 2001 From: sebseb7 Date: Tue, 24 Mar 2026 07:27:40 +0100 Subject: [PATCH] feat: Update translation models and enhance order status handling in OrdersTab with new 'picked_up' status and corresponding translations across multiple locales --- src/components/profile/OrdersTab.js | 35 +++++++---- src/i18n/locales/ar/orders.js | 41 ++++++------- src/i18n/locales/bg/orders.js | 87 ++++++++++++++------------- src/i18n/locales/cs/orders.js | 29 ++++----- src/i18n/locales/de/orders.js | 3 +- src/i18n/locales/el/orders.js | 41 ++++++------- src/i18n/locales/en/orders.js | 39 ++++++------ src/i18n/locales/es/orders.js | 29 ++++----- src/i18n/locales/fr/orders.js | 31 +++++----- src/i18n/locales/hr/orders.js | 37 ++++++------ src/i18n/locales/hu/orders.js | 49 +++++++-------- src/i18n/locales/it/orders.js | 29 ++++----- src/i18n/locales/pl/orders.js | 33 +++++----- src/i18n/locales/ro/orders.js | 93 +++++++++++++++-------------- src/i18n/locales/ru/orders.js | 31 +++++----- src/i18n/locales/sk/orders.js | 39 ++++++------ src/i18n/locales/sl/orders.js | 37 ++++++------ src/i18n/locales/sq/orders.js | 39 ++++++------ src/i18n/locales/sr/orders.js | 45 +++++++------- src/i18n/locales/sv/orders.js | 33 +++++----- src/i18n/locales/tr/orders.js | 27 +++++---- src/i18n/locales/uk/orders.js | 41 ++++++------- src/i18n/locales/zh/orders.js | 47 ++++++++------- translate-i18n.js | 8 +-- 24 files changed, 477 insertions(+), 446 deletions(-) diff --git a/src/components/profile/OrdersTab.js b/src/components/profile/OrdersTab.js index 29e3976..cb9106d 100644 --- a/src/components/profile/OrdersTab.js +++ b/src/components/profile/OrdersTab.js @@ -33,22 +33,35 @@ import { } from "../../utils/wireGirocodeEligibility.js"; // Constants -const getStatusTranslation = (status, t) => { +const getStatusTranslation = (status, deliveryMethod, t) => { const statusMap = { new: t ? t('orders.status.new') : "in Bearbeitung", pending: t ? t('orders.status.pending') : "Neu", processing: t ? t('orders.status.processing') : "in Bearbeitung", paid: t ? t('orders.status.paid') : "Bezahlt", cancelled: t ? t('orders.status.cancelled') : "Storniert", - shipped: t ? t('orders.status.shipped') : "Verschickt", - delivered: t ? t('orders.status.delivered') : "Geliefert", + shipped: deliveryMethod === "Abholung" + ? (t ? t('orders.status.picked_up') : "Abgeholt") + : (t ? t('orders.status.shipped') : "Verschickt"), + delivered: deliveryMethod === "Abholung" + ? (t ? t('orders.status.picked_up') : "Abgeholt") + : (t ? t('orders.status.delivered') : "Geliefert"), awaiting_tracking: t ? t('orders.status.awaiting_tracking') : "Wird gepackt", ready_for_pickup: t ? t('orders.status.ready_for_pickup') : "Abholbereit", }; return statusMap[status] || status; }; -const statusEmojis = { +const getStatusEmoji = (status, deliveryMethod) => { + if (deliveryMethod === "Abholung" && status === "shipped") { + return "✅"; + } + + if (deliveryMethod === "Abholung" && status === "delivered") { + return "✅"; + } + + const statusEmojis = { new: "⚙️", pending: "⏳", processing: "🔄", @@ -59,6 +72,8 @@ const statusEmojis = { awaiting_tracking: "📦", ready_for_pickup: "🏪", }; + return statusEmojis[status] || "❓"; +}; const statusColors = { new: "#ed6c02", // orange @@ -140,12 +155,8 @@ const OrdersTab = ({ orderIdFromHash, t }) => { } }, [orderIdFromHash, orders, handleViewDetails]); - const getStatusDisplay = (status) => { - return getStatusTranslation(status, t); - }; - - const getStatusEmoji = (status) => { - return statusEmojis[status] || "❓"; + const getStatusDisplay = (status, deliveryMethod) => { + return getStatusTranslation(status, deliveryMethod, t); }; const getStatusColor = (status) => { @@ -232,7 +243,7 @@ const OrdersTab = ({ orderIdFromHash, t }) => { {orders.map((order) => { - const displayStatus = getStatusDisplay(order.status); + const displayStatus = getStatusDisplay(order.status, order.delivery_method); const total = order.items.reduce( (acc, item) => acc + item.price * item.quantity_ordered, 0 @@ -254,7 +265,7 @@ const OrdersTab = ({ orderIdFromHash, t }) => { }} > - {getStatusEmoji(order.status)} + {getStatusEmoji(order.status, order.delivery_method)} English (critical step) -const ENGLISH_TO_OTHER_MODEL = 'gpt-4.1-mini'; // Faster/cheaper model for English -> Other languages +const ENGLISH_TO_OTHER_MODEL = 'gpt-5.4-mini'; // Faster/cheaper model for English -> Other languages // Supported languages for translation const TARGET_LANGUAGES = { @@ -379,7 +379,7 @@ async function translateContent(content, systemPrompt, targetLanguage = null, mo } // Function to translate English to other languages (optimized for caching) -async function translateToTargetLanguage(englishContent, targetLanguage, model = 'gpt-4.1-mini', isLegalFile = false) { +async function translateToTargetLanguage(englishContent, targetLanguage, model = 'gpt-5.4-mini', isLegalFile = false) { try { // Choose appropriate system prompt based on file type const promptTemplate = isLegalFile @@ -396,9 +396,7 @@ async function translateToTargetLanguage(englishContent, targetLanguage, model = messages: [ { role: 'system', content: systemPrompt }, { role: 'user', content: `Please translate to ${targetLanguage}` } - ], - temperature: 0.1, - max_tokens: 4000 + ] }); return response.choices[0].message.content;