From 242f1d7d7f96ec27f3d2c9aafa8324f2ee9b28fd Mon Sep 17 00:00:00 2001 From: Nicolas Gorga <62995075+NicolasGorga@users.noreply.github.com> Date: Fri, 2 Jan 2026 07:44:42 -0300 Subject: [PATCH] feat(dashboard,draft-order): Remove hardcoded strings and replace with translations in draft orders list page (#14400) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary **What** — What changes are introduced in this PR? Add translations management to draft orders list page. **Why** — Why are these changes relevant or necessary? We were using hardcoded English strings. **How** — How have these changes been implemented? Remove hardcoded strings and replace them with dynamic translations. **Testing** — How have these changes been tested, or how can the reviewer test the feature? *Please provide answer here* --- ## Examples Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice. This helps with documentation and ensures maintainers can quickly understand and verify the change. ```ts // Example usage ``` --- ## Checklist Please ensure the following before requesting a review: - [x] I have added a **changeset** for this PR - Every non-breaking change should be marked as a **patch** - To add a changeset, run `yarn changeset` and follow the prompts - [ ] The changes are covered by relevant **tests** - [x] I have verified the code works as intended locally - [x] I have linked the related issue(s) if applicable --- ## Additional Context Add any additional context, related issues, or references that might help the reviewer understand this PR. closes #14377 --- .changeset/smart-kiwis-fold.md | 6 +++++ .../src/i18n/translations/$schema.json | 26 +++++++++++++++++++ .../dashboard/src/i18n/translations/en.json | 8 ++++++ .../dashboard/src/i18n/translations/es.json | 8 ++++++ .../src/admin/routes/draft-orders/page.tsx | 14 +++++----- 5 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 .changeset/smart-kiwis-fold.md diff --git a/.changeset/smart-kiwis-fold.md b/.changeset/smart-kiwis-fold.md new file mode 100644 index 0000000000..d9fb5891f3 --- /dev/null +++ b/.changeset/smart-kiwis-fold.md @@ -0,0 +1,6 @@ +--- +"@medusajs/draft-order": patch +"@medusajs/dashboard": patch +--- + +feat(dashboard,draft-order): Remove hardcoded strings and replace with translations in draft orders list page diff --git a/packages/admin/dashboard/src/i18n/translations/$schema.json b/packages/admin/dashboard/src/i18n/translations/$schema.json index 0bf56cd517..982d97a20f 100644 --- a/packages/admin/dashboard/src/i18n/translations/$schema.json +++ b/packages/admin/dashboard/src/i18n/translations/$schema.json @@ -5860,6 +5860,32 @@ "required": ["open", "completed"], "additionalProperties": false }, + "list": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "noRecordsMessage": { + "type": "string" + }, + "filtered": { + "type": "object", + "properties": { + "heading": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": ["heading", "description"], + "additionalProperties": false + } + }, + "required": ["description", "noRecordsMessage", "filtered"], + "additionalProperties": false + }, "create": { "type": "object", "properties": { diff --git a/packages/admin/dashboard/src/i18n/translations/en.json b/packages/admin/dashboard/src/i18n/translations/en.json index 49e5520542..f51530747b 100644 --- a/packages/admin/dashboard/src/i18n/translations/en.json +++ b/packages/admin/dashboard/src/i18n/translations/en.json @@ -1569,6 +1569,14 @@ "sendNotificationLabel": "Send notification", "sendNotificationHint": "Send a notification to the customer when the draft order is created." }, + "list": { + "noRecordsMessage": "No draft orders found", + "description": "Create a new draft order to get started.", + "filtered": { + "heading": "No results found", + "description": "No draft orders match your filter criteria." + } + }, "validation": { "requiredEmailOrCustomer": "Email or customer is required.", "requiredItems": "At least one item is required.", diff --git a/packages/admin/dashboard/src/i18n/translations/es.json b/packages/admin/dashboard/src/i18n/translations/es.json index 496e8f5ca7..543d942368 100644 --- a/packages/admin/dashboard/src/i18n/translations/es.json +++ b/packages/admin/dashboard/src/i18n/translations/es.json @@ -1504,6 +1504,14 @@ }, "draftOrders": { "domain": "Pedidos Borradores", + "list": { + "description": "Crea un nuevo pedido borrador para empezar.", + "noRecordsMessage": "No se encontraron pedidos borradores", + "filtered": { + "heading": "No se encontraron resultados", + "description": "No hay pedidos borradores que coincidan con los criterios de filtro." + } + }, "deleteWarning": "Estás a punto de eliminar el pedido borrador {{id}}. Esta acción no puede deshacerse.", "paymentLinkLabel": "Enlace de pago", "cartIdLabel": "ID del carrito", diff --git a/packages/plugins/draft-order/src/admin/routes/draft-orders/page.tsx b/packages/plugins/draft-order/src/admin/routes/draft-orders/page.tsx index d7284a7bf1..cd29ba6f20 100644 --- a/packages/plugins/draft-order/src/admin/routes/draft-orders/page.tsx +++ b/packages/plugins/draft-order/src/admin/routes/draft-orders/page.tsx @@ -18,6 +18,7 @@ import { useSalesChannels } from "../../hooks/api/sales-channels" import { useDataTableDateFilters } from "../../hooks/common/use-data-table-date-filters" import { useQueryParams } from "../../hooks/common/use-query-params" import { getFullDate } from "../../lib/utils/date-utils" +import { useTranslation } from "react-i18next" const PAGE_SIZE = 20 @@ -26,6 +27,7 @@ export const handle = { } const List = () => { + const { t } = useTranslation() const queryParams = useDraftOrderTableQuery({ pageSize: PAGE_SIZE, }) @@ -60,20 +62,20 @@ const List = () => { isLoading={isPending} pageSize={PAGE_SIZE} rowCount={count} - heading="Draft Orders" + heading={t("draftOrders.domain")} action={{ - label: "Create", + label: t("actions.create"), to: "create", }} rowHref={(row) => `${row.id}`} emptyState={{ empty: { - heading: "No draft orders found", - description: "Create a new draft order to get started.", + heading: t("draftOrders.list.noRecordsMessage"), + description: t("draftOrders.list.description"), }, filtered: { - heading: "No results found", - description: "No draft orders match your filter criteria.", + heading: t("draftOrders.list.filtered.heading"), + description: t("draftOrders.list.filtered.description"), }, }} />