Skip to content

Enhance Portuguese translations and restructure i18n schema#14986

Open
VicenzoMF wants to merge 8 commits intomedusajs:developfrom
VicenzoMF:feat/ptBR-order-translations
Open

Enhance Portuguese translations and restructure i18n schema#14986
VicenzoMF wants to merge 8 commits intomedusajs:developfrom
VicenzoMF:feat/ptBR-order-translations

Conversation

@VicenzoMF
Copy link
Copy Markdown
Contributor

@VicenzoMF VicenzoMF commented Mar 31, 2026

Summary

What — What changes are introduced in this PR?

This PR contains updates related to internationalization (i18n) and minor dependency adjustments for the admin dashboard. The key changes are:

  • Schema updates for translations ($schema.json) to fix key names, required lists, ordering, and add additionalProperties: false where appropriate.
  • Added new translation keys and values in en.json and ptBR.json (e.g., awaitingShipping, awaitingPickup, awaitingDelivery, shippingOptionTypes, several store fields, and translations domain).
  • Replaced hard-coded UI strings with i18n lookups (t(...)) in order-related components.
  • Adjusted packages/admin/dashboard/package.json (removed direct i18next dependency and added prettier) and updated yarn.lock to reflect dependency changes (including updates to @swc/core and addition of prettier).

Why — Why are these changes relevant or necessary?

  • Fixes inconsistencies and missing keys in the translation schema that could cause validation errors or missing UI text.
  • Adds missing translations so the admin UI correctly displays localized strings for fulfillment and shipping states in both English and Brazilian Portuguese.
  • Replaces hard-coded strings in components to ensure all UI text is provided by the i18n system, easing future translations and consistency.
  • Keeps the workspace dependencies aligned and adds formatting tooling (prettier) as needed; updates to yarn.lock ensure reproducible installs.

How — How have these changes been implemented?

  • Edited packages/admin/dashboard/src/i18n/translations/$schema.json:
    • Renamed properties where appropriate (e.g., swap selectAll/unselectAll keys where required).
    • Reordered and updated required arrays.
    • Added additionalProperties: false to objects to tighten validation.
    • Added new translation keys and nested blocks (e.g., shippingOptionTypes, translations domain entries).
  • Updated packages/admin/dashboard/src/i18n/translations/en.json and .../ptBR.json with new keys and localized strings.
  • Updated components to use the translator function:
    • order-fulfillment-section.tsx now uses t("orders.fulfillment.awaitingPickup"), t("orders.fulfillment.awaitingShipping"), and t("orders.fulfillment.awaitingDelivery").
    • order-payment-section.tsx now uses t("orders.payment.status.canceled"), t("orders.payment.status.captured"), and t("orders.payment.status.awaiting").
  • Adjusted packages/admin/dashboard/package.json (removed explicit i18next entry and added prettier) and committed yarn.lock updates (adds prettier and updates @swc/core resolutions).

Testing — How have these changes been tested, or how can the reviewer test the feature?

Manual testing steps:

  1. Install dependencies:
    • Run yarn install at the repository root (ensure yarn.lock is used).
  2. Build the admin dashboard:
    • Run the workspace build script (e.g., yarn build or the project-specific build command).
  3. Run the admin locally (dev mode or serve the built bundle) and verify UI strings:
    • Open an Order detail page and confirm fulfillment status text:
      • If requires_shipping is true and it's a pickup: shows orders.fulfillment.awaitingPickup (PT-BR: Aguardando retirada).
      • If requires_shipping is true and not a pickup: shows orders.fulfillment.awaitingShipping (PT-BR: Aguardando envio).
      • If requires_shipping is false: shows orders.fulfillment.awaitingDelivery (PT-BR: Aguardando entrega).
    • On the payment subsection of an order, verify payment statuses display correctly:
      • Canceled: orders.payment.status.canceled
      • Captured: orders.payment.status.captured
      • Pending/awaiting: orders.payment.status.awaiting
  4. Verify new UI domains and labels:
    • Check screens related to shippingOptionTypes, store fields (default sales channel, default location, default locale), and translations domain to ensure labels appear in the chosen locale (en / pt-BR).
  5. Run automated tests (if available):
    • yarn test (or package-specific test command) to ensure no regressions.
  6. Validate translation JSONs against the updated $schema.json:
    • If your repo has a script/CI job to validate translations, run it to confirm en.json and ptBR.json pass the schema.

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.

// Example: fulfillment status now comes from i18n
let statusText = fulfillment.requires_shipping
  ? isPickUpFulfillment
    ? t("orders.fulfillment.awaitingPickup")
    : t("orders.fulfillment.awaitingShipping")
  : t("orders.fulfillment.awaitingDelivery")
// Example: payment status now uses translation keys
const getPaymentStatusAttributes = (payment: AdminPayment) => {
  if (payment.canceled_at) {
    return [t("orders.payment.status.canceled"), "red"]
  } else if (payment.captured_at) {
    return [t("orders.payment.status.captured"), "green"]
  } else {
    return [t("orders.payment.status.awaiting"), "orange"]
  }
}

Checklist

Please ensure the following before requesting a review:

  • 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
  • I have verified the code works as intended locally (build + manual UI checks)
  • I have linked the related issue(s) if applicable

Additional Context

  • yarn.lock changes include addition of prettier for the $schema.json command to work. Ensure CI builds on all target platforms succeed after these lockfile changes.
  • The updated $schema.json adds additionalProperties: false in multiple places. This strengthens validation but may require future translation files to strictly follow the schema shape.
  • If this PR is only translation-related, consider creating a patch changeset. If lockfile or dependency updates change consumer behavior, choose the appropriate changeset type.

Note

Medium Risk
Medium risk due to schema strictness changes (additionalProperties: false and required key reshuffles) that can break translation validation/builds, plus order status label changes that may surface missing/incorrect i18n keys.

Overview
Updates the dashboard translation $schema.json to reorder/rename keys, adjust required lists, and add broader additionalProperties: false constraints (including new/expanded sections like translations).

Extends en.json and especially ptBR.json with new UI strings (e.g., fulfillment awaiting states, draft order list empty/filtered messaging, store default fields, shipping option types, promotions templates/status/limits, and new refund-reason copy).

Adjusts order detail UI to use i18n keys for fulfillment “awaiting …” statuses and payment status labels; fulfillment “Canceled/Shipped/Delivered” labels are now hard-coded strings. Adds prettier@^3.8.1 to the dashboard devDependencies (with corresponding yarn.lock update).

Written by Cursor Bugbot for commit d0fed30. This will update automatically on new commits. Configure here.

VicenzoMF and others added 4 commits March 17, 2026 15:38
Restructure i18n schema and translations:
- swap selectAll/unselectAll and adjust required/additionalProperties
- add shippingOptionTypes and store defaults in translation files
- update order components to use new translation keys
- switch payment status to use i18n strings
@VicenzoMF VicenzoMF requested a review from a team as a code owner March 31, 2026 19:01
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 096ca67

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 77 packages
Name Type
@medusajs/dashboard Patch
@medusajs/admin-bundler Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/medusa-oas-cli Patch
integration-tests-http Patch
@medusajs/analytics Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/caching Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/rbac Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/settings Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/translation Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/workflow-engine-redis Patch
@medusajs/draft-order Patch
@medusajs/oas-github-ci Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/analytics-local Patch
@medusajs/analytics-posthog Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/caching-redis Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/framework Patch
@medusajs/js-sdk Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/types Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch
@medusajs/http-types-generator Patch
@medusajs/cli Patch
@medusajs/deps Patch
@medusajs/telemetry Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
create-medusa-app Patch
medusa-dev-cli Patch
@medusajs/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

@VicenzoMF is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

"awaitingFulfillmentBadge": "Awaiting fulfillment",
"awaitingShipping": "Awaiting shipping",
"awaitingPickup": "Awaiting pickup",
"awaitingDelivery": "Awaiting Delivery",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent capitalization in awaitingDelivery translation value

Low Severity

The value "Awaiting Delivery" uses title case for "Delivery", while the adjacent entries "awaitingShipping" and "awaitingPickup" use sentence case ("Awaiting shipping", "Awaiting pickup"). This creates a visible inconsistency in the UI when these strings appear as status badges.

Fix in Cursor Fix in Web

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 31, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 1, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@medusa-os-bot
Copy link
Copy Markdown

medusa-os-bot bot commented Apr 9, 2026

Thank you for your contribution!

After reviewing this PR, we need a few things addressed before we can move forward:

Required changes:

  • Add a changeset file by running yarn changeset and selecting @medusajs/dashboard as a patch. The changeset message must follow this format: feat(@medusajs/dashboard): <short description> or chore(@medusajs/dashboard): <short description>

Notes:

This PR goes beyond a translation-only contribution — it adds new source keys to en.json and modifies .tsx components. Our admin translation guidelines ask that translation PRs only translate existing keys without adding new ones or including code changes. That said, the component changes here are tightly coupled to the new keys, so the approach is understandable. Just be aware that mixed PRs like this are reviewed as code contributions and require a changeset.

  • prettier devDependency (packages/admin/dashboard/package.json): The PR adds prettier as a local devDependency. The PR body mentions it's needed "for the $schema.json command to work", but prettier is already available at the monorepo level. Please clarify why a local dependency is necessary — if it's just for formatting, this addition may not be needed.

  • additionalProperties: false in $schema.json: Adding this constraint broadly will cause validation failures for any translation file that has extra keys not captured in the schema (including future language files). Please verify this is intentional and that all existing translation files still pass schema validation after this change.

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 9, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 9, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant