Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ Learn more about translation, how to manage translations, and how to translate c

## Routes with Localization Enabled by Default

The Medusa application automatically supports retrieving localized content from all routes under the `/store` prefix, including both core and custom store API routes.
The Medusa application automatically applies the `applyLocale` middleware to all routes under the `/store` prefix. This makes `req.locale` available in every store route handler, and it allows your custom store routes to read the locale without additional middleware configuration.

For example, the following store routes have localization enabled by default:
However, applying the locale middleware does not mean every route translates its response automatically. Translation only happens when the route handler (or an underlying helper) resolves the locale and retrieves the appropriate translations. In Medusa's built-in store routes, translation is applied to the following routes:

- `/store/products` -> Get products with translated fields
- `/store/collections` -> Get collections with translated fields
- `/store/categories` -> Get categories with translated fields
- `/store/products` and `/store/products/:id`: product fields such as `title` and `description`
- `/store/product-variants` and `/store/product-variants/:id`: product variant fields

Other built-in store routes (including `/store/carts/:id`, `/store/customers/me`, and `/store/orders/:id`) receive the locale header but do not retrieve the translated content. Fields on data models reached through those routes, including custom models linked to their records, are returned untranslated even when `x-medusa-locale` is set.

<Note>

If you need translated fields on a model that is fetched through a non-translating route (for example, a custom model linked to a cart or order), create a custom store route that queries the model directly and [applies the translations](!resources!/commerce-modules/translation/custom-data-models).

</Note>

Refer to the [Translation Module](!resources!/commerce-modules/translation#supported-module-translations) documentation for a list of supported core data models with localization support.

Expand Down
Loading