From ebb16d6020d85e558f72ac9705986345d0412da4 Mon Sep 17 00:00:00 2001 From: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:42:59 +0200 Subject: [PATCH] fix(dashboard): Translate breadcrumbs (#9561) **What** - Adds translated keys for all static breadcrumbs. --- .../dashboard/src/i18n/translations/en.json | 4 -- .../dashboard/src/i18n/translations/index.ts | 1 - .../providers/router-provider/route-map.tsx | 61 ++++++++----------- 3 files changed, 27 insertions(+), 39 deletions(-) diff --git a/packages/admin/dashboard/src/i18n/translations/en.json b/packages/admin/dashboard/src/i18n/translations/en.json index e51669a889..fc38ce5f24 100644 --- a/packages/admin/dashboard/src/i18n/translations/en.json +++ b/packages/admin/dashboard/src/i18n/translations/en.json @@ -1350,10 +1350,6 @@ "shippingProfiles": { "label": "Shipping Profiles", "description": "Group products by shipping requirements" - }, - "shippingOptionTypes": { - "label": "Shipping Option Types", - "description": "Group options based on characteristic" } }, "salesChannels": { diff --git a/packages/admin/dashboard/src/i18n/translations/index.ts b/packages/admin/dashboard/src/i18n/translations/index.ts index 23676c85ce..fb100f35c8 100644 --- a/packages/admin/dashboard/src/i18n/translations/index.ts +++ b/packages/admin/dashboard/src/i18n/translations/index.ts @@ -1,5 +1,4 @@ import en from "./en.json" - export default { en: { translation: en, diff --git a/packages/admin/dashboard/src/providers/router-provider/route-map.tsx b/packages/admin/dashboard/src/providers/router-provider/route-map.tsx index 9c1c497628..33449aa70e 100644 --- a/packages/admin/dashboard/src/providers/router-provider/route-map.tsx +++ b/packages/admin/dashboard/src/providers/router-provider/route-map.tsx @@ -1,6 +1,7 @@ import { AdminProductCategoryResponse, HttpTypes } from "@medusajs/types" import { Outlet, RouteObject } from "react-router-dom" +import { t } from "i18next" import { ProtectedRoute } from "../../components/authentication/protected-route" import { MainLayout } from "../../components/layout/main-layout" import { PublicLayout } from "../../components/layout/public-layout" @@ -33,7 +34,7 @@ export const RouteMap: RouteObject[] = [ path: "/products", errorElement: , handle: { - crumb: () => "Products", + crumb: () => t("products.domain"), }, children: [ { @@ -171,7 +172,7 @@ export const RouteMap: RouteObject[] = [ path: "/categories", errorElement: , handle: { - crumb: () => "Categories", + crumb: () => t("categories.domain"), }, children: [ { @@ -225,7 +226,7 @@ export const RouteMap: RouteObject[] = [ path: "/orders", errorElement: , handle: { - crumb: () => "Orders", + crumb: () => t("orders.domain"), }, children: [ { @@ -288,7 +289,7 @@ export const RouteMap: RouteObject[] = [ path: "/promotions", errorElement: , handle: { - crumb: () => "Promotions", + crumb: () => t("promotions.domain"), }, children: [ { @@ -329,7 +330,7 @@ export const RouteMap: RouteObject[] = [ { path: "/campaigns", errorElement: , - handle: { crumb: () => "Campaigns" }, + handle: { crumb: () => t("campaigns.domain") }, children: [ { path: "", @@ -372,7 +373,7 @@ export const RouteMap: RouteObject[] = [ path: "/collections", errorElement: , handle: { - crumb: () => "Collections", + crumb: () => t("collections.domain"), }, children: [ { @@ -415,7 +416,7 @@ export const RouteMap: RouteObject[] = [ path: "/price-lists", errorElement: , handle: { - crumb: () => "Price Lists", + crumb: () => t("priceLists.domain"), }, children: [ { @@ -468,7 +469,7 @@ export const RouteMap: RouteObject[] = [ path: "/customers", errorElement: , handle: { - crumb: () => "Customers", + crumb: () => t("customers.domain"), }, children: [ { @@ -514,7 +515,7 @@ export const RouteMap: RouteObject[] = [ path: "/customer-groups", errorElement: , handle: { - crumb: () => "Customer Groups", + crumb: () => t("customerGroups.domain"), }, children: [ { @@ -570,7 +571,7 @@ export const RouteMap: RouteObject[] = [ path: "/reservations", errorElement: , handle: { - crumb: () => "Reservations", + crumb: () => t("reservations.domain"), }, children: [ { @@ -619,7 +620,7 @@ export const RouteMap: RouteObject[] = [ path: "/inventory", errorElement: , handle: { - crumb: () => "Inventory", + crumb: () => t("inventory.domain"), }, children: [ { @@ -690,7 +691,7 @@ export const RouteMap: RouteObject[] = [ { path: "/settings", handle: { - crumb: () => "Settings", + crumb: () => t("app.nav.settings.header"), }, element: , children: [ @@ -704,7 +705,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , lazy: () => import("../../routes/profile/profile-detail"), handle: { - crumb: () => "Profile", + crumb: () => t("profile.domain"), }, children: [ { @@ -718,7 +719,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , element: , handle: { - crumb: () => "Regions", + crumb: () => t("regions.domain"), }, children: [ { @@ -757,7 +758,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , lazy: () => import("../../routes/store/store-detail"), handle: { - crumb: () => "Store", + crumb: () => t("store.domain"), }, children: [ { @@ -779,7 +780,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , element: , handle: { - crumb: () => "Users", + crumb: () => t("users.domain"), }, children: [ { @@ -816,7 +817,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , element: , handle: { - crumb: () => "Sales Channels", + crumb: () => t("salesChannels.domain"), }, children: [ { @@ -870,7 +871,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , element: , handle: { - crumb: () => "Locations & Shipping", + crumb: () => t("locations.domain"), }, children: [ { @@ -885,7 +886,7 @@ export const RouteMap: RouteObject[] = [ path: "shipping-profiles", element: , handle: { - crumb: () => "Shipping Profiles", + crumb: () => t("shippingProfile.domain"), }, children: [ { @@ -917,14 +918,6 @@ export const RouteMap: RouteObject[] = [ }, ], }, - { - path: "shipping-option-types", - errorElement: , - element: , - handle: { - crumb: () => "Shipping Option Types", - }, - }, { path: ":location_id", lazy: () => import("../../routes/locations/location-detail"), @@ -1020,7 +1013,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , element: , handle: { - crumb: () => "Product Tags", + crumb: () => t("productTags.domain"), }, children: [ { @@ -1058,7 +1051,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , element: , handle: { - crumb: () => "Workflows", + crumb: () => t("workflowExecutions.domain"), }, children: [ { @@ -1091,7 +1084,7 @@ export const RouteMap: RouteObject[] = [ errorElement: , element: , handle: { - crumb: () => "Product Types", + crumb: () => t("productTypes.domain"), }, children: [ { @@ -1128,7 +1121,7 @@ export const RouteMap: RouteObject[] = [ path: "publishable-api-keys", element: , handle: { - crumb: () => "Publishable API Keys", + crumb: () => t("apiKeyManagement.domain.publishable"), }, children: [ { @@ -1187,7 +1180,7 @@ export const RouteMap: RouteObject[] = [ path: "secret-api-keys", element: , handle: { - crumb: () => "Secret API Keys", + crumb: () => t("apiKeyManagement.domain.secret"), }, children: [ { @@ -1239,7 +1232,7 @@ export const RouteMap: RouteObject[] = [ path: "tax-regions", element: , handle: { - crumb: () => "Tax Regions", + crumb: () => t("taxRegions.domain"), }, children: [ { @@ -1371,7 +1364,7 @@ export const RouteMap: RouteObject[] = [ path: "return-reasons", element: , handle: { - crumb: () => "Return Reasons", + crumb: () => t("returnReasons.domain"), }, children: [ {