fix(utils): skip empty string translations when applying locale#15013
Open
asynchroza wants to merge 2 commits intomedusajs:developfrom
Open
fix(utils): skip empty string translations when applying locale#15013asynchroza wants to merge 2 commits intomedusajs:developfrom
asynchroza wants to merge 2 commits intomedusajs:developfrom
Conversation
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 detectedLatest commit: cb6c0fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 77 packages
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 |
|
@asynchroza is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for your contribution! After reviewing this PR, we need a few things addressed before we can move forward: Required changes:
Once you've updated the description and changeset, another review will be triggered automatically. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
yarn changesetand follow the prompts