trendmicro-frontend / tonic-ui

Tonic UI is a UI component library for React, built with Emotion and Styled System. It is designed to be easy to use and easy to customize.
https://trendmicro-frontend.github.io/tonic-ui
MIT License
125 stars 28 forks source link

Support localization for Tonic UI components #891

Open cheton opened 1 month ago

cheton commented 1 month ago

Overview

https://mui.com/material-ui/guides/localization/

MUI utilizes the theme to configure the locale text globally:

import { createTheme, ThemeProvider } from '@mui/material/styles';
import { zhCN } from '@mui/material/locale';

const theme = createTheme(
  {
    palette: {
      primary: { main: '#1976d2' },
    },
  },
  zhCN,
);

<ThemeProvider theme={theme}>
  <App />
</ThemeProvider>;

For more details, you can find the source in the GitHub repository.

To support localization in Tonic UI, DefaultPropsProvider must be implemented. Here are the relevant links:

Related issues: #73, #180