[FEAT] Adding translations for defaultColumnTypes'. filterOperators
sohaibgv opened this issue · 3 comments
Is your feature request related to a problem? Please describe.
I want to be able to add translations in the dictionary and make refine automatically use these for the default filterOperators' labels without needing to build my own filters from scratch. Since this is not possible, using the defaultOperators makes it that I get labels that don't translate along. I have to define my own currently anyway so that I can override the label with a translation, which defeats the purpose of having a default. Unable to find a way to do this currently. It makes a lot of sense to pull these by default from your translation provider and fallback to the labels that already exist currently.
Describe alternatives you've considered
No response
Additional context
Filters don't translate along:
Describe the thing to improve
Ideally you simply pass a list of the following type in for example de-DE/common.json:
"filters": { "operators": { "is": "ist", "between": "zwischen", "notBetween": "nicht zwischen", "null": "ist null", "notNull": "ist nicht null" } }, ...
Which makes it that all the filter labels are translated.
Hey @sohaibgv thanks for the issue, looks like a good idea. Would you like to work on this one after discussing the details?
I found that these translations are actually already defined by the UI library you use and not by refine.
We were using MUI and these ones actually exist in
import { enUS, nlNL } from '@mui/x-data-grid/locales';
Some of the translations that were missing specifically came from
import { nlNL, enUS } from '@mui/x-date-pickers/locales';
and
import { enUS, nlNL } from '@mui/material/locale';
These imports are required to make the filters translate on locale changes.
You can look at the keys MUI defines and add these for any missing locales.