-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[code-infra] Embed translations in the @mui/docs package #41246
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@Janpot, I noticed an issue while trying to use the package - the translations.json file is not included in the build output. |
require.context
may not exist where this is being used.