-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[data grid] Stop importing locales from @mui/material package #7028
Comments
That is a good initiative. 👍 One possible solution could be to duplicate translation needed (let's say for Table Pagination as it's the only one being used in x-data-grid from core) from
We can probably think about having a dedicated package for storing locales like import { GridLocales } from '@mui/locales'
import { CoreLocales } from '@mui/locales'
import { PickerLocales } from '@mui/locales' It may provide decoupling to be able to support other packages like Joy UI and also the need of bumping @mui/material will not be there for |
I think that Not a huge fan of the idea to be honest |
The PR on other repo thing seems a real pain point, yes. |
If the whole pain comes from 2-3 translation keys re-used from the core, I do agree that duplicating is maybe the easiest way to remove this pain. |
I think we can solve (2) with something like this: import { DataGrid, nlNL } from '@mui/x-data-grid';
import MaterialSlots from '@mui/x-data-grid/material';
// Material slots have their own locales that might import from `@mui/material`
import { nlNL as nlNLMaterial } from '@mui/x-data-grid/material/locales';
const localesText = {
...nlNL.components.MuiDataGrid.defaultProps.localeText,
...nlNLMaterial.components.MuiDataGrid.defaultProps.localeText,
};
<DataGrid localeText={localesText} /> This way we can decouple grid core locales and locales that are used by Material slots (e.g. For (1) - maybe we should have a separate entry point for each locale? import nlNL from '@mui/x-data-grid/locale/nlNL'; Then you'll only be affected if you use the specific locale. But I also wonder what would actually happen if in #6866 we start exporting |
The current bundling strategy do not support this depth of import.
Technically we should bump the minimum version of the peer deps. |
I exported |
Summary 💡
Currently,
@mui/x-data-grid
imports locales from@mui/material
:mui-x/packages/grid/x-data-grid/src/locales/enUS.ts
Line 1 in ec5b70e
There are a few issues with this:
@mui/material
, the grid has to bump the minimal supported version of@mui/material
to the version in which the new locale was released.Example: [DataGrid] Add Urdu (ur-PK) locale #6866
This would force our users to upgrade their
@mui/material
dependency, even though most of them probably won't use the new locale.@mui/material
to support other UI libraries like@mui/joy
Examples 🌈
No response
Motivation 🔦
No response
Order ID 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: