-
-
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
[DataGrid] Include MUI core component localizations in localeText
#1913
Changes from 1 commit
ec6b49b
d425b3a
8d9e5fc
8f42808
fd998f9
16955a3
186fd72
3de6ae8
9cd4f15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,20 +27,18 @@ export const getGridLocalization = ( | |
components: { | ||
MuiDataGrid: { | ||
defaultProps: { | ||
localeText: gridTranslations, | ||
localeText: { ...gridTranslations, ...coreTranslations?.components }, | ||
}, | ||
}, | ||
...coreTranslations?.components, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to revert this line and its v4 counterpart below. If another component from the core is used, it will not get translations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @m4theushw It seems that you envision a different solution. This change seems to be OK/aligned with the intent to have all the translations happening inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no problem with appending the core translations into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see your worry - I will update the docs to match this implementation. That's why it's marked as a breaking change because you will no longer import all translations from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The table component not translated sounds like the expected behavior, translations do no longer leak. |
||
}, | ||
}; | ||
} | ||
|
||
return { | ||
props: { | ||
MuiDataGrid: { | ||
localeText: gridTranslations, | ||
localeText: { ...gridTranslations, ...coreTranslations?.props }, | ||
}, | ||
...coreTranslations?.props, | ||
}, | ||
}; | ||
}; |
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.
We don't natively use all these components. Why should we add them all?
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.
One question I would have is, let's say we want to implement Ant Design, as a design specification. How does these change fit?
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.
We don't, correct but for some of them, it does make sense to have them. Technically we only use the
MuiTablePagination
so we can only keep that one and add the rest on demand if we happen to use them in the future. The benefit is that that way all the localizations are kept together.@oliviertassinari regarding the Ant Design - I didn't understand the problem - is it if we use a different pagination component?
Actually, these are only here because the way that the
getLocaleText
API works is that it throws an error if the key doesn't exist. If that was not the case we woudn't need to keep these here at all.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.
I would keep only
MuiTablePagination
. If we add all of them it might create doubts for who is doing translations.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.
Different design specs can be supported in different ways. The most likely path (>80%) we will take is that we will expose the same MuiPagination structure, but styled differently. The only thing that we would need to do is to reinject the new components. So we might be able to use the same translation keys, as we would display the same content. (I was initially worried about the coupling of the translation keys, all good)