feat(): Introduce translation module and preliminary application of them (#14189)

* feat(): Translation first steps

* feat(): locale middleware

* feat(): readonly links

* feat(): feature flag

* feat(): modules sdk

* feat(): translation module re export

* start adding workflows

* update typings

* update typings

* test(): Add integration tests

* test(): centralize filters preparation

* test(): centralize filters preparation

* remove unnecessary importy

* fix workflows

* Define StoreLocale inside Store Module

* Link definition to extend Store with supported_locales

* store_locale migration

* Add supported_locales handling in Store Module

* Tests

* Accept supported_locales in Store endpoints

* Add locales to js-sdk

* Include locale list and default locale in Store Detail section

* Initialize local namespace in js-sdk

* Add locales route

* Make code primary key of locale table to facilitate upserts

* Add locales routes

* Show locale code as is

* Add list translations api route

* Batch endpoint

* Types

* New batchTranslationsWorkflow and various updates to existent ones

* Edit default locale UI

* WIP

* Apply translation agnostically

* middleware

* Apply translation agnostically

* fix Apply translation agnostically

* apply translations to product list

* Add feature flag

* fetch translations by batches of 250 max

* fix apply

* improve and test util

* apply to product list

* dont manage translations if no locale

* normalize locale

* potential todo

* Protect translations routes with feature flag

* Extract normalize locale util to core/utils

* Normalize locale on write

* Normalize locale for read

* Use feature flag to guard translations UI across the board

* Avoid throwing incorrectly when locale_code not present in partial updates

* move applyTranslations util

* remove old tests

* fix util tests

* fix(): product end points

* cleanup

* update lock

* remove unused var

* cleanup

* fix apply locale

* missing new dep for test utils

* Change entity_type, entity_id to reference, reference_id

* Remove comment

* Avoid registering translations route if ff not enabled

* Prevent registering express handler for disabled route via defineFileConfig

* Add tests

* Add changeset

* Update test

* fix integration tests, module and internals

* Add locale id plus fixed

* Allow to pass array of reference_id

* fix unit tests

* fix link loading

* fix store route

* fix sales channel test

* fix tests

---------

Co-authored-by: Nicolas Gorga <nicogorga11@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-12-08 19:33:08 +01:00
committed by GitHub
co-authored by Nicolas Gorga Oli Juhl
parent fea3d4ec49
commit 6dc0b8bed8
130 changed files with 5649 additions and 112 deletions
+17
View File
@@ -3799,6 +3799,7 @@ __metadata:
"@medusajs/store": 2.12.1
"@medusajs/tax": 2.12.1
"@medusajs/telemetry": 2.12.1
"@medusajs/translation": 2.12.1
"@medusajs/user": 2.12.1
"@medusajs/workflow-engine-inmemory": 2.12.1
"@medusajs/workflow-engine-redis": 2.12.1
@@ -4050,6 +4051,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@medusajs/test-utils@workspace:packages/medusa-test-utils"
dependencies:
"@medusajs/core-flows": 2.12.1
"@medusajs/framework": 2.12.1
"@types/express": ^4.17.21
axios: ^1.13.1
@@ -4057,9 +4059,12 @@ __metadata:
get-port: ^5.1.1
ulid: ^2.3.0
peerDependencies:
"@medusajs/core-flows": 2.12.1
"@medusajs/framework": 2.12.1
"@medusajs/medusa": 2.12.1
peerDependenciesMeta:
"@medusajs/core-flows":
optional: true
"@medusajs/medusa":
optional: true
languageName: unknown
@@ -4085,6 +4090,17 @@ __metadata:
languageName: unknown
linkType: soft
"@medusajs/translation@2.12.1, @medusajs/translation@workspace:*, @medusajs/translation@workspace:packages/modules/translation":
version: 0.0.0-use.local
resolution: "@medusajs/translation@workspace:packages/modules/translation"
dependencies:
"@medusajs/framework": 2.12.1
"@medusajs/test-utils": 2.12.1
peerDependencies:
"@medusajs/framework": 2.12.1
languageName: unknown
linkType: soft
"@medusajs/types@2.12.1, @medusajs/types@workspace:^, @medusajs/types@workspace:packages/core/types":
version: 0.0.0-use.local
resolution: "@medusajs/types@workspace:packages/core/types"
@@ -18372,6 +18388,7 @@ __metadata:
"@medusajs/store": "workspace:^"
"@medusajs/tax": "workspace:^"
"@medusajs/test-utils": "workspace:*"
"@medusajs/translation": "workspace:*"
"@medusajs/types": "workspace:^"
"@medusajs/user": "workspace:^"
"@medusajs/utils": "workspace:^"