Skip to content

Conversation

@adrien2p
Copy link
Member

@adrien2p adrien2p commented Dec 2, 2025

Summary

This PR introduces the Translation Module - a new first-party module for multi-language support in Medusa. The module provides a centralized way to manage translations for any entity
type (products, categories, etc.) with support for BCP 47 locale codes.

Key Features

  • Locale Management: Pre-populated with 48 common locales (en-US, fr-FR, de-DE, etc.) with support for custom locales
  • Entity Translation Storage: Store translations as JSONB with a unique constraint on (entity_id, entity_type, locale_code)
  • JSONB Search: Full-text search within translated content using the q filter
  • Locale Resolution Middleware: Automatically resolves locale from Accept-Language header or locale query parameter
  • Read-only Product Links: Connect products to their translations via the link modules system
  • Feature Flagged: Disabled by default, enable via MEDUSA_FF_TRANSLATION=true for both API layer and Admin UI
  • Store supported locales: You can select which of the available locales your Store supports
  • Translations batch API: manage translations with a single batch API admin endpoint
  • Apply translations on the fly for products (including relations translations, automanaged with bulk fetching baked in)

Changes

New Module (@medusajs/translation)

  • Locale model: Stores available locales (code, name)
  • Translation model: Stores translations with entity reference and JSONB content
  • TranslationModuleService: Full CRUD operations with JSONB search capability
  • Integration tests covering all happy/unhappy paths

Update Store Module

  • Link to Translation Module Locale to define supported_locales
  • New UI in detail and edit components to update the relation

Core Types (@medusajs/types)

  • ITranslationModuleService interface
  • DTOs: LocaleDTO, TranslationDTO, CreateTranslationDTO, UpdateTranslationDTO
  • Filterable props with q parameter for JSONB search

Core Flows (@medusajs/core-flows)

  • createTranslationsStep / createTranslationsWorkflow
  • updateTranslationsStep / updateTranslationsWorkflow
  • deleteTranslationsStep / deleteTranslationsWorkflow
  • validateTranslationsStep
  • batchTranslationsWorkflow

Framework

  • applyLocale middleware: Resolves locale from request headers/query params
  • normalizeLocale: Applies normalization on write/read operations for the local code
  • Module registered in Modules.TRANSLATION

Medusa Package

  • Feature flag: translation.ts
  • Product middleware integration for locale-aware responses
  • Read-only link: product-translation.ts
  • applyTranslations
    • batch querying
    • auto apply translation to input objects (including nested)
  • applied the above to product retrieve and list store api routes

@changeset-bot
Copy link

changeset-bot bot commented Dec 2, 2025

🦋 Changeset detected

Latest commit: 3fc13c4

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

This PR includes changesets to release 75 packages
Name Type
@medusajs/framework Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/analytics Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/caching Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis 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/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/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/draft-order Patch
@medusajs/core-flows Patch
integration-tests-http Patch
@medusajs/medusa-oas-cli Patch
@medusajs/oas-github-ci Patch
@medusajs/js-sdk Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/types Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch
@medusajs/cli Patch
@medusajs/deps Patch
@medusajs/telemetry Patch
@medusajs/admin-bundler Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/dashboard 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

vercel bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

8 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
api-reference Ignored Ignored Dec 8, 2025 3:58pm
api-reference-v2 Ignored Ignored Preview Dec 8, 2025 3:58pm
cloud-docs Ignored Ignored Preview Dec 8, 2025 3:58pm
docs-ui Ignored Ignored Preview Dec 8, 2025 3:58pm
docs-v2 Ignored Ignored Preview Dec 8, 2025 3:58pm
medusa-docs Ignored Ignored Preview Dec 8, 2025 3:58pm
resources-docs Ignored Ignored Preview Dec 8, 2025 3:58pm
user-guide Ignored Ignored Preview Dec 8, 2025 3:58pm

@adrien2p adrien2p changed the title Feat/translation module feat(): Introduce translation module and preliminary application of them Dec 5, 2025
@adrien2p adrien2p mentioned this pull request Dec 5, 2025
5 tasks
@adrien2p adrien2p force-pushed the feat/translation-module branch from 7f4475c to d74b2bd Compare December 5, 2025 18:09
@adrien2p adrien2p force-pushed the feat/translation-module branch 2 times, most recently from 6fd20da to 32e553e Compare December 8, 2025 10:17
@adrien2p adrien2p force-pushed the feat/translation-module branch from 32e553e to 2ae796d Compare December 8, 2025 10:17
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.

6 participants