[code-infra] Embed translations in the @mui/docs package#41246
[code-infra] Embed translations in the @mui/docs package#41246Janpot merged 8 commits intomui:masterfrom
Conversation
Netlify deploy previewhttps://deploy-preview-41246--material-ui.netlify.app/ Bundle size report |
|
It seems to me that these translations are Core-specific. The JSON file is created based on the Core directory structure (at least partially), so how do you see sharing this file between repos? (although this may not be the most burning problem as we don't have translations enabled anywhere AFAIK) |
|
As far as I can see only core repo is using this translation file. X/Toolpad seem to be hardcoding the titles in en only. But I agree it's not ideal. I'll see if I can create a context that we can use to supply custom strings that code-infra relies on, but that are consumer specific, e.g. like those page titles. We can then keep embedding the other strings for common UI like the header. |
|
@michaldudak I've split the pages property off of the translations file and embedded the rest in the docs package. The pages part is injected in the DocsProvider through getInitialProps in _app.js. In the i18n module I'm merging all strings together and make them available in a context. WDYT? |
|
@Janpot, I noticed an issue while trying to use the package - the translations.json file is not included in the build output. |
require.contextmay not exist where this is being used.