diff --git a/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.js b/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.js index 97e371bf4a5..7e5269208e4 100644 --- a/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.js +++ b/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.js @@ -1,7 +1,7 @@ import * as React from 'react'; import { AppProvider } from '@toolpad/core/AppProvider'; import { SignInPage } from '@toolpad/core/SignInPage'; -import hiIN from '@toolpad/core/locales/hiIN'; +import { hiIN } from '@toolpad/core/locales'; const providers = [ { id: 'github', name: 'गिटहब' }, diff --git a/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.tsx b/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.tsx index 30bd309ff82..28cb13b4ef8 100644 --- a/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.tsx +++ b/docs/data/toolpad/core/components/sign-in-page/LocaleSignInPage.tsx @@ -5,7 +5,7 @@ import { type AuthProvider, type AuthResponse, } from '@toolpad/core/SignInPage'; -import hiIN from '@toolpad/core/locales/hiIN'; +import { hiIN } from '@toolpad/core/locales'; const providers = [ { id: 'github', name: 'गिटहब' }, diff --git a/docs/data/toolpad/core/introduction/base-concepts.md b/docs/data/toolpad/core/introduction/base-concepts.md index 3ff30f94601..1330fb1fd23 100644 --- a/docs/data/toolpad/core/introduction/base-concepts.md +++ b/docs/data/toolpad/core/introduction/base-concepts.md @@ -121,7 +121,7 @@ To translate all your Toolpad components, you can provide translations through t ```tsx import { createTheme, ThemeProvider } from '@mui/material/styles'; import { hiIN as coreHiIn } from '@mui/material/locale'; -import hiIN from '@toolpad/core/locales/hiIN'; +import { hiIN } from '@toolpad/core/locales'; const theme = createTheme({ { @@ -144,7 +144,7 @@ If you want to pass language translations without using `createTheme`, you can d ```tsx import { AppProvider } from '@toolpad/core/AppProvider'; -import hiIN from '@toolpad/core/locales/hiIN'; +import { hiIN } from '@toolpad/core/locales'; function App({ children }) { return ( diff --git a/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx b/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx index fea49ee8ec5..e0b921a5fd9 100644 --- a/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx +++ b/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import { useTheme } from '@mui/material/styles'; -import DEFAULT_LOCALE from '../locales/en'; +import { en as DEFAULT_LOCALE } from '../locales'; export interface LocaleText { // Account diff --git a/packages/toolpad-core/src/index.ts b/packages/toolpad-core/src/index.ts index e40b9ada6ce..aa7a843d09b 100644 --- a/packages/toolpad-core/src/index.ts +++ b/packages/toolpad-core/src/index.ts @@ -23,3 +23,5 @@ export * from './useSession'; export * from './useSessionStorageState'; export * from './persistence/codec'; + +export * from './locales'; diff --git a/packages/toolpad-core/src/locales/en.tsx b/packages/toolpad-core/src/locales/en.tsx index cde73141187..0b706cf0247 100644 --- a/packages/toolpad-core/src/locales/en.tsx +++ b/packages/toolpad-core/src/locales/en.tsx @@ -1,7 +1,7 @@ import type { LocaleText } from '../AppProvider'; import { getLocalization } from './getLocalization'; -const en: LocaleText = { +const enLabels: LocaleText = { // Account accountSignInLabel: 'Sign In', accountSignOutLabel: 'Sign Out', @@ -55,4 +55,4 @@ const en: LocaleText = { deletedItemMessage: 'This item has been deleted.', }; -export default getLocalization(en); +export default getLocalization(enLabels); diff --git a/packages/toolpad-core/src/locales/index.tsx b/packages/toolpad-core/src/locales/index.tsx new file mode 100644 index 00000000000..64af5b01392 --- /dev/null +++ b/packages/toolpad-core/src/locales/index.tsx @@ -0,0 +1,2 @@ +export { default as hiIN } from './hiIN'; +export { default as en } from './en';