Skip to content

fix(utils): skip empty string translations when applying locale#15013

Open
asynchroza wants to merge 2 commits intomedusajs:developfrom
asynchroza:fix/utils-skip-empty-translation-strings
Open

fix(utils): skip empty string translations when applying locale#15013
asynchroza wants to merge 2 commits intomedusajs:developfrom
asynchroza:fix/utils-skip-empty-translation-strings

Conversation

@asynchroza
Copy link
Copy Markdown

@asynchroza asynchroza commented Apr 5, 2026

Translation records may include empty strings for fields the Admin UI did not localize (e.g. title left blank while description is set). Those values must not overwrite the base entity fields.

Summary

What — What changes are introduced in this PR?

In the translation function, we first check whether the string is empty. If it is empty, we leave the original translation unchanged instead of overriding it.

Why — Why are these changes relevant or necessary?

This is done to prevent making two separate UI requests when merging translation entries and resolving fallbacks properly.

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

Add the translation module and configure two languages. Create a product with the title defined only in the default language, and the description defined in both languages. When fetching the product using the secondary language locale, the title should fall back to the default language value, while the description should appear in the secondary language. Without this fix, the title would be returned as empty.


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
  • I have linked the related issue(s) if applicable

Translation records may include empty strings for fields the Admin UI
did not localize (e.g. title left blank while description is set).
Those values must not overwrite the base entity fields.

Made-with: Cursor
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 5, 2026

🦋 Changeset detected

Latest commit: cb6c0fc

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

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

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

A member of the Team first needs to authorize it.

@asynchroza asynchroza marked this pull request as ready for review April 5, 2026 20:16
@asynchroza asynchroza requested a review from a team as a code owner April 5, 2026 20:16
@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:

  • Please fill in the How section of the PR description (it's currently missing). Describe how the change was implemented — e.g. which condition was added and where in apply-translations.ts.
  • Verify the changeset bump type. The changeset bot reports @medusajs/utils: Major, but this is a bug fix and should be patch. Please run yarn changeset and select patch when prompted, or update .changeset/honest-planes-walk.md directly.

Once you've updated the description and changeset, another review will be triggered automatically.

Thanks!

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