feat(): Translation settings + user configuration + admin hook and js sdk + dashboard (#14355)

* feat(): Translation settings + user configuration

* feat(): Translation settings + user configuration

* Create gentle-bees-grow.md

* add entities end point

* add entities end point

* add admin hook and js sdk method

* update changeset

* fix tests

* fix tests

* rm unnecessary copy

* update dashboard to use the new resources

* update dashboard to use the new resources

* update dashboard to use the new resources

* allow type inference through interface augmentation in the defineConfig of medusa-config

* allow type inference through interface augmentation in the defineConfig of medusa-config

* exclude id and _id props

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-12-19 15:29:48 +01:00
committed by GitHub
co-authored by Oli Juhl
parent 797878af26
commit b21a599d11
26 changed files with 1041 additions and 260 deletions
@@ -0,0 +1,29 @@
import { TranslationTypes } from "@medusajs/framework/types"
export function filterTranslationFields(
translations: TranslationTypes.TranslationDTO[],
translatableFieldsConfig: Record<string, string[]>
): TranslationTypes.TranslationDTO[] {
return translations.map((translation) => {
const allowedFields = translatableFieldsConfig[translation.reference]
if (!allowedFields?.length) {
translation.translations = {}
return translation
}
const filteredTranslations: Record<string, unknown> = {}
for (const field of allowedFields) {
if (
translation.translations &&
field in (translation.translations as Record<string, unknown>)
) {
filteredTranslations[field] = (
translation.translations as Record<string, unknown>
)[field]
}
}
translation.translations = filteredTranslations
return translation
})
}