Skip to content
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
5581ce2
feat(): Translation first steps
adrien2p Dec 2, 2025
5a84338
feat(): locale middleware
adrien2p Dec 2, 2025
14ca5ff
feat(): readonly links
adrien2p Dec 2, 2025
1d45f86
feat(): feature flag
adrien2p Dec 2, 2025
794f592
feat(): modules sdk
adrien2p Dec 2, 2025
bbba2ed
feat(): translation module re export
adrien2p Dec 2, 2025
f97b0da
start adding workflows
adrien2p Dec 2, 2025
c198243
update typings
adrien2p Dec 2, 2025
bd0f433
update typings
adrien2p Dec 2, 2025
38f0c21
test(): Add integration tests
adrien2p Dec 2, 2025
0a89f8a
test(): centralize filters preparation
adrien2p Dec 2, 2025
62af02e
test(): centralize filters preparation
adrien2p Dec 2, 2025
a76e65a
remove unnecessary importy
adrien2p Dec 2, 2025
66a8cd7
fix workflows
adrien2p Dec 2, 2025
fd3df5d
Merge branch 'develop' into feat/translation-module
adrien2p Dec 2, 2025
93796b5
Define StoreLocale inside Store Module
NicolasGorga Dec 2, 2025
9807183
Link definition to extend Store with supported_locales
NicolasGorga Dec 2, 2025
153849d
store_locale migration
NicolasGorga Dec 2, 2025
28c5018
Add supported_locales handling in Store Module
NicolasGorga Dec 2, 2025
c3a8599
Tests
NicolasGorga Dec 2, 2025
e42455d
Accept supported_locales in Store endpoints
NicolasGorga Dec 2, 2025
f6d03e9
Add locales to js-sdk
NicolasGorga Dec 2, 2025
26ca428
Include locale list and default locale in Store Detail section
NicolasGorga Dec 2, 2025
eb2a860
Initialize local namespace in js-sdk
NicolasGorga Dec 2, 2025
e7c3ab9
Add locales route
NicolasGorga Dec 2, 2025
9b4dbec
Make code primary key of locale table to facilitate upserts
NicolasGorga Dec 2, 2025
ab38c4d
Add locales routes
NicolasGorga Dec 2, 2025
8f47d8f
Show locale code as is
NicolasGorga Dec 2, 2025
6c3a36c
Add list translations api route
NicolasGorga Dec 3, 2025
c7aff85
Batch endpoint
NicolasGorga Dec 3, 2025
6cc001b
Types
NicolasGorga Dec 3, 2025
04f0c36
New batchTranslationsWorkflow and various updates to existent ones
NicolasGorga Dec 3, 2025
ccd207f
Edit default locale UI
NicolasGorga Dec 3, 2025
917f53b
WIP
adrien2p Dec 3, 2025
3030e2d
Apply translation agnostically
adrien2p Dec 3, 2025
8fa8b6a
middleware
adrien2p Dec 3, 2025
fd02d45
Apply translation agnostically
adrien2p Dec 3, 2025
4cb0aef
fix Apply translation agnostically
adrien2p Dec 3, 2025
5e308c5
apply translations to product list
adrien2p Dec 3, 2025
af5eb6a
Add feature flag
adrien2p Dec 3, 2025
fa6525d
fetch translations by batches of 250 max
adrien2p Dec 3, 2025
ae58b71
fix apply
adrien2p Dec 3, 2025
fb72e69
improve and test util
adrien2p Dec 3, 2025
214e34c
apply to product list
adrien2p Dec 3, 2025
277935d
dont manage translations if no locale
adrien2p Dec 3, 2025
a95e27f
normalize locale
adrien2p Dec 3, 2025
8c3614c
potential todo
adrien2p Dec 3, 2025
6e0a6d7
Protect translations routes with feature flag
NicolasGorga Dec 3, 2025
68902c1
Extract normalize locale util to core/utils
NicolasGorga Dec 3, 2025
0dc9f3e
Normalize locale on write
NicolasGorga Dec 3, 2025
c6ad624
Normalize locale for read
NicolasGorga Dec 3, 2025
6e9b814
Use feature flag to guard translations UI across the board
NicolasGorga Dec 3, 2025
30b90df
Avoid throwing incorrectly when locale_code not present in partial up…
NicolasGorga Dec 4, 2025
b1547d1
move applyTranslations util
adrien2p Dec 5, 2025
d6cf3c6
remove old tests
adrien2p Dec 5, 2025
544bcf0
fix util tests
adrien2p Dec 5, 2025
ccf0a57
fix(): product end points
adrien2p Dec 5, 2025
8d5997c
cleanup
adrien2p Dec 5, 2025
427725b
resolve conflicts
adrien2p Dec 5, 2025
b076bd7
update lock
adrien2p Dec 5, 2025
de760c2
remove unused var
adrien2p Dec 5, 2025
5019497
cleanup
adrien2p Dec 5, 2025
64bb31f
fix apply locale
adrien2p Dec 5, 2025
d74b2bd
missing new dep for test utils
adrien2p Dec 5, 2025
f9d8d13
Change entity_type, entity_id to reference, reference_id
NicolasGorga Dec 5, 2025
fc12a28
Merge branch 'develop' into feat/translation-module
olivermrbl Dec 7, 2025
a210483
Remove comment
NicolasGorga Dec 7, 2025
18316c2
Avoid registering translations route if ff not enabled
NicolasGorga Dec 7, 2025
d874cf6
Prevent registering express handler for disabled route via defineFile…
NicolasGorga Dec 7, 2025
2f8e051
Add tests
NicolasGorga Dec 7, 2025
050f5d0
Add changeset
NicolasGorga Dec 7, 2025
fa03fcd
Update test
NicolasGorga Dec 7, 2025
b4b2063
Merge branch 'fix/prevent-registering-handler-disabled-route' into fe…
NicolasGorga Dec 7, 2025
1627619
Merge branch 'develop' into feat/translation-module
olivermrbl Dec 8, 2025
2ae796d
fix integration tests, module and internals
adrien2p Dec 8, 2025
7477153
resolve conflicts
adrien2p Dec 8, 2025
bed4e6c
Add locale id plus fixed
adrien2p Dec 8, 2025
9d2f40a
Allow to pass array of reference_id
NicolasGorga Dec 8, 2025
7daac99
Merge branch 'develop' into feat/translation-module
olivermrbl Dec 8, 2025
ffa4573
fix unit tests
adrien2p Dec 8, 2025
df083be
fix link loading
adrien2p Dec 8, 2025
e33c154
fix store route
adrien2p Dec 8, 2025
1ccb309
fix sales channel test
adrien2p Dec 8, 2025
3fc13c4
fix tests
adrien2p Dec 8, 2025
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ packages/*
!packages/create-medusa-app
!packages/modules/product
!packages/modules/locking
!packages/modules/translation
!packages/core/orchestration
!packages/core/workflows-sdk
!packages/core/core-flows
Expand Down
83 changes: 42 additions & 41 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,56 +93,57 @@ module.exports = {
"./packages/design-system/toolbox/tsconfig.json",

"./packages/cli/create-medusa-app/tsconfig.json",
"./packages/cli/medusa-cli/tsconfig.spec.json",
"./packages/cli/oas/medusa-oas-cli/tsconfig.spec.json",
"./packages/cli/medusa-cli/tsconfig.json",
"./packages/cli/oas/medusa-oas-cli/tsconfig.json",

"./packages/core/orchestration/tsconfig.json",
"./packages/core/workflows-sdk/tsconfig.spec.json",
"./packages/core/workflows-sdk/tsconfig.json",
"./packages/core/modules-sdk/tsconfig.json",
"./packages/core/js-sdk/tsconfig.json",
"./packages/core/types/tsconfig.json",
"./packages/core/utils/tsconfig.spec.json",
"./packages/core/utils/tsconfig.json",
"./packages/core/medusa-test-utils/tsconfig.json",

"./packages/modules/product/tsconfig.json",
"./packages/modules/event-bus-local/tsconfig.spec.json",
"./packages/modules/event-bus-redis/tsconfig.spec.json",
"./packages/modules/cache-redis/tsconfig.spec.json",
"./packages/modules/cache-inmemory/tsconfig.spec.json",
"./packages/modules/caching/tsconfig.spec.json",
"./packages/modules/workflow-engine-redis/tsconfig.spec.json",
"./packages/modules/workflow-engine-inmemory/tsconfig.spec.json",
"./packages/modules/fulfillment/tsconfig.spec.json",
"./packages/modules/api-key/tsconfig.spec.json",
"./packages/modules/auth/tsconfig.spec.json",
"./packages/modules/cart/tsconfig.spec.json",
"./packages/modules/currency/tsconfig.spec.json",
"./packages/modules/index/tsconfig.spec.json",
"./packages/modules/customer/tsconfig.spec.json",
"./packages/modules/file/tsconfig.spec.json",
"./packages/modules/inventory-next/tsconfig.spec.json",
"./packages/modules/stock-location-next/tsconfig.spec.json",
"./packages/modules/order/tsconfig.spec.json",
"./packages/modules/payment/tsconfig.spec.json",
"./packages/modules/pricing/tsconfig.spec.json",
"./packages/modules/promotion/tsconfig.spec.json",
"./packages/modules/region/tsconfig.spec.json",
"./packages/modules/sales-channel/tsconfig.spec.json",
"./packages/modules/store/tsconfig.spec.json",
"./packages/modules/tax/tsconfig.spec.json",
"./packages/modules/workflow-engine-inmemory/tsconfig.spec.json",
"./packages/modules/workflow-engine-redis/tsconfig.spec.json",
"./packages/modules/link-modules/tsconfig.spec.json",
"./packages/modules/user/tsconfig.spec.json",
"./packages/modules/locking/tsconfig.spec.json",
"./packages/modules/event-bus-local/tsconfig.json",
"./packages/modules/event-bus-redis/tsconfig.json",
"./packages/modules/cache-redis/tsconfig.json",
"./packages/modules/cache-inmemory/tsconfig.json",
"./packages/modules/caching/tsconfig.json",
"./packages/modules/workflow-engine-redis/tsconfig.json",
"./packages/modules/workflow-engine-inmemory/tsconfig.json",
"./packages/modules/fulfillment/tsconfig.json",
"./packages/modules/api-key/tsconfig.json",
"./packages/modules/auth/tsconfig.json",
"./packages/modules/cart/tsconfig.json",
"./packages/modules/currency/tsconfig.json",
"./packages/modules/index/tsconfig.json",
"./packages/modules/customer/tsconfig.json",
"./packages/modules/file/tsconfig.json",
"./packages/modules/inventory-next/tsconfig.json",
"./packages/modules/stock-location-next/tsconfig.json",
"./packages/modules/order/tsconfig.json",
"./packages/modules/payment/tsconfig.json",
"./packages/modules/pricing/tsconfig.json",
"./packages/modules/promotion/tsconfig.json",
"./packages/modules/region/tsconfig.json",
"./packages/modules/sales-channel/tsconfig.json",
"./packages/modules/store/tsconfig.json",
"./packages/modules/tax/tsconfig.json",
"./packages/modules/workflow-engine-inmemory/tsconfig.json",
"./packages/modules/workflow-engine-redis/tsconfig.json",
"./packages/modules/link-modules/tsconfig.json",
"./packages/modules/user/tsconfig.json",
"./packages/modules/locking/tsconfig.json",
"./packages/modules/translation/tsconfig.json",

"./packages/modules/providers/file-local/tsconfig.spec.json",
"./packages/modules/providers/file-s3/tsconfig.spec.json",
"./packages/modules/providers/fulfillment-manual/tsconfig.spec.json",
"./packages/modules/providers/payment-stripe/tsconfig.spec.json",
"./packages/modules/providers/locking-postgres/tsconfig.spec.json",
"./packages/modules/providers/locking-redis/tsconfig.spec.json",
"./packages/modules/providers/caching-redis/tsconfig.spec.json",
"./packages/modules/providers/file-local/tsconfig.json",
"./packages/modules/providers/file-s3/tsconfig.json",
"./packages/modules/providers/fulfillment-manual/tsconfig.json",
"./packages/modules/providers/payment-stripe/tsconfig.json",
"./packages/modules/providers/locking-postgres/tsconfig.json",
"./packages/modules/providers/locking-redis/tsconfig.json",
"./packages/modules/providers/caching-redis/tsconfig.json",

"./packages/framework/tsconfig.json",
],
Expand Down
14 changes: 8 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Thank you for considering contributing to Medusa! This document will outline how
If you're contributing to our documentation, make sure to also check out the [contribution guidelines on our documentation website](https://docs.medusajs.com/resources/contribution-guidelines/docs).

### Important

Our core maintainers prioritize pull requests (PRs) from within our organization. External contributions are regularly triaged, but not at any fixed cadence. It varies depending on how busy the maintainers are. This is applicable to all types of PRs, so we kindly ask for your patience.

If you, as a community contributor, wish to work on more extensive features, please reach out to CODEOWNERS instead of directly submitting a PR with all the changes. This approach saves us both time, especially if the PR is not accepted (which will be the case if it does not align with our roadmap), and helps us effectively review and evaluate your contribution if it is accepted.
Expand All @@ -26,11 +27,10 @@ If you, as a community contributor, wish to work on more extensive features, ple
## Local development

> Prerequisites:
>
> 1. [Forked Medusa repository cloned locally](https://github.com/medusajs/medusa).
> 2. [A local Medusa application for testing](https://docs.medusajs.com/learn/installation).



The code snippets in this section assume that your forked Medusa project and the test project are sibling directories, and you optionally setup the starter storefront as part of the installation. For example:

```
Expand All @@ -42,8 +42,7 @@ The code snippets in this section assume that your forked Medusa project and the
|__ test-project_storefront // (optional) storefront to interact with medusa application
```


1. Replace the @medusajs/* dependencies and devDependencies in you test project's `package.json` to point to the corresponding local packages in your forked Medusa repository. You will also need to add the medusa packages in the resolutions section of the `package.json`, so that every dependency is resolved locally. For example, assuming your forked Medusa project and the test project are sibling directories:
1. Replace the @medusajs/\* dependencies and devDependencies in you test project's `package.json` to point to the corresponding local packages in your forked Medusa repository. You will also need to add the medusa packages in the resolutions section of the `package.json`, so that every dependency is resolved locally. For example, assuming your forked Medusa project and the test project are sibling directories:

```json
// test project package.json
Expand Down Expand Up @@ -117,7 +116,8 @@ The code snippets in this section assume that your forked Medusa project and the
"@medusajs/draft-order": "file:../medusa/packages/plugins/draft-order",
"@medusajs/deps": "file:../medusa/packages/deps",
"@medusajs/caching-redis": "file:../medusa/packages/modules/providers/caching-redis",
"@medusajs/caching": "file:../medusa/packages/modules/caching"
"@medusajs/caching": "file:../medusa/packages/modules/caching",
"@medusajs/translation": "file:../medusa/packages/modules/translation",
}
```

Expand All @@ -138,6 +138,7 @@ rm -R node_modules && yarn && yarn dev
### Branches

There are currently two base branches:

- `develop` - development of Medusa 2.0
- `v1.x` - development of Medusa v1.x

Expand All @@ -157,7 +158,7 @@ Strive towards keeping your commits small and isolated - this helps the reviewer

**Base branch**

If you wish to patch v1.x your base branch should be `v1.x`.
If you wish to patch v1.x your base branch should be `v1.x`.

If your changes should result in a new version of Medusa, you will need to generate a **changelog**. Follow [this guide](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) on how to generate a changeset.

Expand Down Expand Up @@ -192,5 +193,6 @@ All PRs should include tests for the changes that are included. We have two type
### Release

The Medusa team will regularly create releases from two release branches:

- `develop` - preview releases of Medusa 2.0
- `v1.x` - official releases of Medusa 1.x
1 change: 1 addition & 0 deletions integration-tests/http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@medusajs/store": "workspace:^",
"@medusajs/tax": "workspace:^",
"@medusajs/test-utils": "workspace:*",
"@medusajs/translation": "workspace:*",
"@medusajs/user": "workspace:^",
"@medusajs/utils": "workspace:^",
"@medusajs/workflow-engine-inmemory": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,10 @@ export function getRouteMap({
path: "currencies",
lazy: () => import("../../routes/store/store-add-currencies"),
},
{
path: "locales",
lazy: () => import("../../routes/store/store-add-locales"),
},
{
path: "metadata/edit",
lazy: () => import("../../routes/store/store-metadata"),
Expand Down
14 changes: 9 additions & 5 deletions packages/admin/dashboard/src/hooks/api/feature-flags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@ import { sdk } from "../../lib/client"

export type FeatureFlags = {
view_configurations?: boolean
translation?: boolean
[key: string]: boolean | undefined
}

export const useFeatureFlags = () => {
return useQuery<FeatureFlags>({
queryKey: ["admin", "feature-flags"],
queryFn: async () => {
const response = await sdk.client.fetch<{ feature_flags: FeatureFlags }>("/admin/feature-flags", {
method: "GET",
})

const response = await sdk.client.fetch<{ feature_flags: FeatureFlags }>(
"/admin/feature-flags",
{
method: "GET",
}
)

return response.feature_flags
},
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
cacheTime: 10 * 60 * 1000, // Keep in cache for 10 minutes
})
}
}
1 change: 1 addition & 0 deletions packages/admin/dashboard/src/hooks/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export * from "./fulfillment-providers"
export * from "./fulfillment-sets"
export * from "./inventory"
export * from "./invites"
export * from "./locales"
export * from "./notification"
export * from "./orders"
export * from "./payment-collections"
Expand Down
52 changes: 52 additions & 0 deletions packages/admin/dashboard/src/hooks/api/locales.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { FetchError } from "@medusajs/js-sdk"
import { HttpTypes } from "@medusajs/types"
import { QueryKey, UseQueryOptions, useQuery } from "@tanstack/react-query"

import { sdk } from "../../lib/client"
import { queryKeysFactory } from "../../lib/query-key-factory"

const LOCALES_QUERY_KEY = "locales" as const
const localesQueryKeys = queryKeysFactory(LOCALES_QUERY_KEY)

export const useLocales = (
query?: HttpTypes.AdminLocaleListParams,
options?: Omit<
UseQueryOptions<
HttpTypes.AdminLocaleListResponse,
FetchError,
HttpTypes.AdminLocaleListResponse,
QueryKey
>,
"queryFn" | "queryKey"
>
) => {
const { data, ...rest } = useQuery({
queryFn: () => sdk.admin.locale.list(query),
queryKey: localesQueryKeys.list(query),
...options,
})

return { ...data, ...rest }
}

export const useLocale = (
id: string,
query?: HttpTypes.AdminLocaleParams,
options?: Omit<
UseQueryOptions<
HttpTypes.AdminLocaleResponse,
FetchError,
HttpTypes.AdminLocaleResponse,
QueryKey
>,
"queryFn" | "queryKey"
>
) => {
const { data, ...rest } = useQuery({
queryKey: localesQueryKeys.detail(id),
queryFn: async () => sdk.admin.locale.retrieve(id, query),
...options,
})

return { ...data, ...rest }
}
28 changes: 28 additions & 0 deletions packages/admin/dashboard/src/i18n/translations/$schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9303,6 +9303,9 @@
"defaultCurrency": {
"type": "string"
},
"defaultLocale": {
"type": "string"
},
"defaultRegion": {
"type": "string"
},
Expand All @@ -9321,6 +9324,9 @@
"inviteLinkTemplate": {
"type": "string"
},
"locales": {
"type": "string"
},
"currencies": {
"type": "string"
},
Expand All @@ -9339,6 +9345,15 @@
"removeCurrencyWarning_other": {
"type": "string"
},
"removeLocaleWarning_one": {
"type": "string"
},
"removeLocaleWarning_other": {
"type": "string"
},
"localeAlreadyAdded": {
"type": "string"
},
"currencyAlreadyAdded": {
"type": "string"
},
Expand All @@ -9358,20 +9373,28 @@
"update": {
"type": "string"
},
"localesUpdated": {
"type": "string"
},
"currenciesUpdated": {
"type": "string"
},
"currenciesRemoved": {
"type": "string"
},
"localesRemoved": {
"type": "string"
},
"updatedTaxInclusivitySuccessfully": {
"type": "string"
}
},
"required": [
"update",
"localesUpdated",
"currenciesUpdated",
"currenciesRemoved",
"localesRemoved",
"updatedTaxInclusivitySuccessfully"
],
"additionalProperties": false
Expand All @@ -9382,19 +9405,24 @@
"manageYourStoresDetails",
"editStore",
"defaultCurrency",
"defaultLocale",
"defaultRegion",
"defaultSalesChannel",
"defaultLocation",
"swapLinkTemplate",
"paymentLinkTemplate",
"inviteLinkTemplate",
"locales",
"currencies",
"addCurrencies",
"enableTaxInclusivePricing",
"disableTaxInclusivePricing",
"removeCurrencyWarning_one",
"removeCurrencyWarning_other",
"removeLocaleWarning_one",
"removeLocaleWarning_other",
"currencyAlreadyAdded",
"localeAlreadyAdded",
"edit",
"toast"
],
Expand Down
Loading
Loading