feat(admin-*,dashboard): add dashboard i18n extensions #13763
+213
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
What
Adds functionality to directly export custom translations to be used in the admin dashboard, supporting both "direct" extensions from the main backend project as well as from plugins
Why
It is currently possible to extend the react-i18next instance provided by medusa, but the process is clunky: it requires the same boilerplate component in every plugin and project and the "extender" component must be used in each custom route/widget, since one cant access the common parent scope. See one of my plugins example
How
By creating a new virtual module for i18n, just like other admin features like routes/widgets etc... the DashboardApp now merges all i18n virtual modules into a single "resources" object which is used to initialize the i18n instance directly
Testing
Local testing. Checked extensions in the main project and in plugins(both plugin:develop and plugin:publish) in development and production env.
I noticed now that the other virtual modules have some form of test for the code generation part, should I add one for i18n as well?
Examples
Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.
This helps with documentation and ensures maintainers can quickly understand and verify the change.
Checklist
Please ensure the following before requesting a review:
yarn changeset
and follow the promptsAdditional Context
Closes #13698