Event Timeline - Localization
The Event Timeline's localization features provide the appropriate translations for users around the world.
The default locale of MUI X is English (United States). To use other locales, follow the instructions below.
Translation keys
You can use the localeText prop to pass in your own text and translations.
You can find all the translation keys supported in the source
in the GitHub repository.
In the following example, the resource column header and loading text are customized.
Locale text
You can use the theme to configure the locale text and replace the default locale:
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { EventTimelinePremium } from '@mui/x-scheduler-premium/event-timeline-premium';
import { frFR } from '@mui/x-scheduler/locales';
// Or import { frFR } from '@mui/x-scheduler-premium/locales';
const theme = createTheme(
{
palette: {
primary: { main: '#1976d2' },
},
},
frFR,
);
<ThemeProvider theme={theme}>
<EventTimelinePremium />
</ThemeProvider>;
Note that createTheme() accepts any number of arguments.
If you are already using the translations of the core components, you can add frFR as a new argument.
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { EventTimelinePremium } from '@mui/x-scheduler-premium/event-timeline-premium';
import { frFR } from '@mui/x-scheduler/locales';
import { frFR as pickersFrFR } from '@mui/x-date-pickers/locales';
import { frFR as coreFrFR } from '@mui/material/locale';
const theme = createTheme(
{
palette: {
primary: { main: '#1976d2' },
},
},
frFR, // x-scheduler translations
pickersFrFR, // x-date-pickers translations
coreFrFR, // core translations
);
<ThemeProvider theme={theme}>
<EventTimelinePremium />
</ThemeProvider>;
If you want to pass language translations directly to the Event Timeline without using createTheme() and ThemeProvider, you can directly load the language translations from @mui/x-scheduler/locales.
import { EventTimelinePremium } from '@mui/x-scheduler-premium/event-timeline-premium';
import { frFR } from '@mui/x-scheduler/locales';
<EventTimelinePremium
localeText={frFR.components.MuiEventTimeline.defaultProps.localeText}
/>;
Date locale
The localeText prop only translates the UI labels (button text, menu items, etc.).
To also translate formatted dates (day names, month names, and week start day), pass a date-fns locale object.
Use the createDateLocaleTheme helper to set the date locale globally via the theme, alongside localeText translations:
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { fr } from 'date-fns/locale/fr';
import { frFR, createDateLocaleTheme } from '@mui/x-scheduler/locales';
import { EventTimelinePremium } from '@mui/x-scheduler-premium/event-timeline-premium';
const theme = createTheme(
{
palette: {
primary: { main: '#1976d2' },
},
},
frFR,
createDateLocaleTheme(fr),
);
<ThemeProvider theme={theme}>
<EventTimelinePremium />
</ThemeProvider>;
You can also pass the dateLocale prop directly to the component to override the theme value or avoid using a theme:
import { fr } from 'date-fns/locale/fr';
import { EventTimelinePremium } from '@mui/x-scheduler-premium/event-timeline-premium';
<EventTimelinePremium dateLocale={fr} />;
Supported locales
You can find the source in the GitHub repository.
| Locale | BCP 47 language tag | Import name |
|---|---|---|
| English (United States) | en-US | enUS |
| French | fr-FR | frFR |
To create your own translation or to customize the English text, copy this file to your project, make any changes needed and import the locale from there. Note that these translations of the Scheduler component depend on the Localization strategy of the whole library.