Commit e487761
authored
feat(): sync cart translation synced (medusajs#14226)
ref: medusajs#14189
**Summary**
This PR extends the translation module to support automatic translation syncing for cart line items based on the cart's locale.
Key changes:
- Added locale field to the Cart model to store the cart's locale preference
- Created new workflow steps:
- getTranslatedLineItemsStep - Translates line items when adding to cart or creating a cart
- updateCartItemsTranslationsStep - Re-translates all cart items when the cart's locale changes
- Integrated translation logic into cart workflows:
- createCartWorkflow - Applies translations to initial line items
- addToCartWorkflow - Applies translations when adding new items
- updateCartWorkflow - Re-translates all items when locale_code is updated
- refreshCartItemsWorkflow - Maintains translations during cart refresh
- Added applyTranslationsToItems utility to map variant/product/type/collection translations to line item fields (title, subtitle, description, etc.)1 parent 356283c commit e487761
File tree
31 files changed
+2641
-1480
lines changed- .changeset
- integration-tests
- http
- __tests__/cart/store
- modules/__tests__/cart/store
- packages
- core
- core-flows/src
- cart
- steps
- utils
- workflows
- translation
- steps
- workflows
- types/src
- cart
- http/cart/store
- medusa-test-utils/src
- medusa/src/api
- admin/translations/batch
- store/carts
- modules/cart/src
- migrations
- models
31 files changed
+2641
-1480
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments