diff --git a/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md b/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md index cfab1b86a920c5..feed2d191c1b15 100644 --- a/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md +++ b/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md @@ -23,3 +23,43 @@ The steps you need to take to migrate from Material UI v7 to v9 are described This list is a work in progress. Expect updates as new breaking changes are introduced. ::: + +### TablePagination numbers are formatted by default + +Pagination numbers in `TablePagination` are now formatted using `Intl.NumberFormat` according to the locale. +For example, `103177` is displayed as `103,177` in `en-US` or `103.177` in `de-DE`. + +To opt out of number formatting, provide a custom `labelDisplayedRows` function: + +```jsx + + `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}` + } +/> +``` + +Or when using a locale: + +```jsx +import { enUS } from '@mui/material/locale'; + +const theme = createTheme( + { + palette: { + primary: { main: '#1976d2' }, + }, + }, + enUS, + { + components: { + MuiTablePagination: { + defaultProps: { + labelDisplayedRows: ({ from, to, count }) => + `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`, + }, + }, + }, + }, +); +``` diff --git a/docs/pages/material-ui/api/table-pagination.json b/docs/pages/material-ui/api/table-pagination.json index dacabc881904e1..34291b781c5c42 100644 --- a/docs/pages/material-ui/api/table-pagination.json +++ b/docs/pages/material-ui/api/table-pagination.json @@ -27,7 +27,7 @@ }, "labelDisplayedRows": { "type": { "name": "func" }, - "default": "function defaultLabelDisplayedRows({ from, to, count }) {\n return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;\n}" + "default": "function defaultLabelDisplayedRows({ from, to, count }) {\n return `${formatNumber(from)}–${formatNumber(to)} of ${count !== -1 ? formatNumber(count) : `more than ${formatNumber(to)}`}`;\n}" }, "labelRowsPerPage": { "type": { "name": "node" }, "default": "'Rows per page:'" }, "nextIconButtonProps": { diff --git a/packages/mui-material/src/TablePagination/TablePagination.d.ts b/packages/mui-material/src/TablePagination/TablePagination.d.ts index 8395c71d2ac8b8..d12a626b0dc50c 100644 --- a/packages/mui-material/src/TablePagination/TablePagination.d.ts +++ b/packages/mui-material/src/TablePagination/TablePagination.d.ts @@ -200,7 +200,7 @@ export interface TablePaginationOwnProps extends TablePaginationBaseProps { * * For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/). * @default function defaultLabelDisplayedRows({ from, to, count }) { - * return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`; + * return `${formatNumber(from)}–${formatNumber(to)} of ${count !== -1 ? formatNumber(count) : `more than ${formatNumber(to)}`}`; * } */ labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => React.ReactNode; diff --git a/packages/mui-material/src/TablePagination/TablePagination.js b/packages/mui-material/src/TablePagination/TablePagination.js index 1bd8ef76c862a1..0eb1d336e695a0 100644 --- a/packages/mui-material/src/TablePagination/TablePagination.js +++ b/packages/mui-material/src/TablePagination/TablePagination.js @@ -17,6 +17,9 @@ import TablePaginationActions from '../TablePaginationActions'; import useId from '../utils/useId'; import tablePaginationClasses, { getTablePaginationUtilityClass } from './tablePaginationClasses'; import useSlot from '../utils/useSlot'; +import { buildFormatNumber } from '../locale/utils/formatNumber'; + +const formatNumber = buildFormatNumber('en-US'); const TablePaginationRoot = styled(TableCell, { name: 'MuiTablePagination', @@ -114,7 +117,7 @@ const TablePaginationDisplayedRows = styled('p', { ); function defaultLabelDisplayedRows({ from, to, count }) { - return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`; + return `${formatNumber(from)}–${formatNumber(to)} of ${count !== -1 ? formatNumber(count) : `more than ${formatNumber(to)}`}`; } function defaultGetAriaLabel(type) { @@ -380,7 +383,7 @@ TablePagination.propTypes /* remove-proptypes */ = { * * For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/). * @default function defaultLabelDisplayedRows({ from, to, count }) { - * return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`; + * return `${formatNumber(from)}–${formatNumber(to)} of ${count !== -1 ? formatNumber(count) : `more than ${formatNumber(to)}`}`; * } */ labelDisplayedRows: PropTypes.func, diff --git a/packages/mui-material/src/locale/amET.ts b/packages/mui-material/src/locale/amET.ts index 3d40a1dead8bc6..4cd75e924dc087 100644 --- a/packages/mui-material/src/locale/amET.ts +++ b/packages/mui-material/src/locale/amET.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('am-ET'); export const amET: Localization = { components: { @@ -24,7 +27,7 @@ export const amET: Localization = { }, labelRowsPerPage: 'ረድፎች በአንድ ገጽ:', labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} ከ ${count !== -1 ? count : `${to} በላይ`}`, + `${formatNumber(from)}-${formatNumber(to)} ከ ${count !== -1 ? formatNumber(count) : `${formatNumber(to)} በላይ`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/arEG.ts b/packages/mui-material/src/locale/arEG.ts index 942f33ed73d1c6..dd8d3891219ef5 100644 --- a/packages/mui-material/src/locale/arEG.ts +++ b/packages/mui-material/src/locale/arEG.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ar-EG'); export const arEG: Localization = { components: { @@ -24,7 +27,7 @@ export const arEG: Localization = { }, labelRowsPerPage: 'عدد الصفوف في الصفحة:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} من ${count !== -1 ? count : ` أكثر من${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} من ${count !== -1 ? formatNumber(count) : ` أكثر من${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/arSA.ts b/packages/mui-material/src/locale/arSA.ts index 06d9cb3e9d134c..4946c8bb75aed3 100644 --- a/packages/mui-material/src/locale/arSA.ts +++ b/packages/mui-material/src/locale/arSA.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ar-SA'); export const arSA: Localization = { components: { @@ -24,7 +27,7 @@ export const arSA: Localization = { }, labelRowsPerPage: 'عدد الصفوف في الصفحة:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} من ${count !== -1 ? count : ` أكثر من${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} من ${count !== -1 ? formatNumber(count) : ` أكثر من${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/arSD.ts b/packages/mui-material/src/locale/arSD.ts index 45649b74356fe9..c101929057335a 100644 --- a/packages/mui-material/src/locale/arSD.ts +++ b/packages/mui-material/src/locale/arSD.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ar-SD'); export const arSD: Localization = { components: { @@ -24,7 +27,7 @@ export const arSD: Localization = { }, labelRowsPerPage: 'عدد الصفوف في الصفحة:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} من ${count !== -1 ? count : ` أكثر من${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} من ${count !== -1 ? formatNumber(count) : ` أكثر من${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/beBY.ts b/packages/mui-material/src/locale/beBY.ts index a94ba59f68e9d9..8a7325f0f64f67 100644 --- a/packages/mui-material/src/locale/beBY.ts +++ b/packages/mui-material/src/locale/beBY.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('be-BY'); export const beBY: Localization = { components: { @@ -24,7 +27,7 @@ export const beBY: Localization = { }, labelRowsPerPage: 'Радкоў на старонцы:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} з ${count !== -1 ? count : `больш чым ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} з ${count !== -1 ? formatNumber(count) : `больш чым ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/bnBD.ts b/packages/mui-material/src/locale/bnBD.ts index 1347ae56f62c2e..e8a09d487459f4 100644 --- a/packages/mui-material/src/locale/bnBD.ts +++ b/packages/mui-material/src/locale/bnBD.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('bn-BD'); export const bnBD: Localization = { components: { @@ -24,7 +27,7 @@ export const bnBD: Localization = { }, labelRowsPerPage: 'প্রতি পৃষ্ঠায় সারি:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} / ${count !== -1 ? count : `${to} থেকে বেশি`}`, + `${formatNumber(from)}–${formatNumber(to)} / ${count !== -1 ? formatNumber(count) : `${formatNumber(to)} থেকে বেশি`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/caES.ts b/packages/mui-material/src/locale/caES.ts index 9d4faf898964a4..0ae4ce32636cb1 100644 --- a/packages/mui-material/src/locale/caES.ts +++ b/packages/mui-material/src/locale/caES.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ca-ES'); export const caES: Localization = { components: { @@ -24,7 +27,7 @@ export const caES: Localization = { }, labelRowsPerPage: 'Files per pàgina:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} de ${count !== -1 ? count : `més de ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} de ${count !== -1 ? formatNumber(count) : `més de ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/csCZ.ts b/packages/mui-material/src/locale/csCZ.ts index e4215276d02cb6..27f4e85939efc3 100644 --- a/packages/mui-material/src/locale/csCZ.ts +++ b/packages/mui-material/src/locale/csCZ.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('cs-CZ'); export const csCZ: Localization = { components: { @@ -24,7 +27,7 @@ export const csCZ: Localization = { }, labelRowsPerPage: 'Řádků na stránce:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} z ${count !== -1 ? count : `více než ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} z ${count !== -1 ? formatNumber(count) : `více než ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/daDK.ts b/packages/mui-material/src/locale/daDK.ts index 432097540e5bfd..0ac1d7acd07cc0 100644 --- a/packages/mui-material/src/locale/daDK.ts +++ b/packages/mui-material/src/locale/daDK.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('da-DK'); export const daDK: Localization = { components: { @@ -24,7 +27,7 @@ export const daDK: Localization = { }, labelRowsPerPage: 'Rækker pr side:', labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} af ${count !== -1 ? count : `mere end ${to}`}`, + `${formatNumber(from)}-${formatNumber(to)} af ${count !== -1 ? formatNumber(count) : `mere end ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/deDE.ts b/packages/mui-material/src/locale/deDE.ts index bb25a6f58076e3..8c9af5f02bc335 100644 --- a/packages/mui-material/src/locale/deDE.ts +++ b/packages/mui-material/src/locale/deDE.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('de-DE'); export const deDE: Localization = { components: { @@ -24,7 +27,7 @@ export const deDE: Localization = { }, labelRowsPerPage: 'Zeilen pro Seite:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} von ${count !== -1 ? count : `mehr als ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} von ${count !== -1 ? formatNumber(count) : `mehr als ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/elGR.ts b/packages/mui-material/src/locale/elGR.ts index 7a5ac9e186e394..47dddc27e5c250 100644 --- a/packages/mui-material/src/locale/elGR.ts +++ b/packages/mui-material/src/locale/elGR.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('el-GR'); export const elGR: Localization = { components: { @@ -25,7 +28,7 @@ export const elGR: Localization = { }, labelRowsPerPage: 'Γραμμές ανα σελίδα:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} από ${count !== -1 ? count : `πάνω από ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} από ${count !== -1 ? formatNumber(count) : `πάνω από ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/esES.ts b/packages/mui-material/src/locale/esES.ts index 31b80953a027bc..5ae36640d7985e 100644 --- a/packages/mui-material/src/locale/esES.ts +++ b/packages/mui-material/src/locale/esES.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('es-ES'); export const esES: Localization = { components: { @@ -24,7 +27,7 @@ export const esES: Localization = { }, labelRowsPerPage: 'Filas por página:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} de ${count !== -1 ? count : `más de ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} de ${count !== -1 ? formatNumber(count) : `más de ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/etEE.ts b/packages/mui-material/src/locale/etEE.ts index 0924693387e873..de65e795043e40 100644 --- a/packages/mui-material/src/locale/etEE.ts +++ b/packages/mui-material/src/locale/etEE.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('et-EE'); export const etEE: Localization = { components: { @@ -24,7 +27,7 @@ export const etEE: Localization = { }, labelRowsPerPage: 'Ridu leheküljel:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} / ${count !== -1 ? count : `rohkem kui ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} / ${count !== -1 ? formatNumber(count) : `rohkem kui ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/faIR.ts b/packages/mui-material/src/locale/faIR.ts index b435ff5345b879..8a85b6b889fe75 100644 --- a/packages/mui-material/src/locale/faIR.ts +++ b/packages/mui-material/src/locale/faIR.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('fa-IR'); export const faIR: Localization = { components: { @@ -29,7 +32,7 @@ export const faIR: Localization = { }, labelRowsPerPage: 'تعداد سطرهای هر صفحه:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} از ${count !== -1 ? count : `بیشتر از ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} از ${count !== -1 ? formatNumber(count) : `بیشتر از ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/fiFI.ts b/packages/mui-material/src/locale/fiFI.ts index f356bc04742229..e465f322347d6a 100644 --- a/packages/mui-material/src/locale/fiFI.ts +++ b/packages/mui-material/src/locale/fiFI.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('fi-FI'); export const fiFI: Localization = { components: { @@ -24,7 +27,7 @@ export const fiFI: Localization = { }, labelRowsPerPage: 'Rivejä per sivu:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} / ${count !== -1 ? count : `enemmän kuin ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} / ${count !== -1 ? formatNumber(count) : `enemmän kuin ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/frFR.ts b/packages/mui-material/src/locale/frFR.ts index d13bfb700ac12f..1cb768d8db2f94 100644 --- a/packages/mui-material/src/locale/frFR.ts +++ b/packages/mui-material/src/locale/frFR.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('fr-FR'); export const frFR: Localization = { components: { @@ -24,7 +27,7 @@ export const frFR: Localization = { }, labelRowsPerPage: 'Lignes par page :', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} sur ${count !== -1 ? count : `plus que ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} sur ${count !== -1 ? formatNumber(count) : `plus que ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/heIL.ts b/packages/mui-material/src/locale/heIL.ts index 78d28b45686d69..819f33db801f3b 100644 --- a/packages/mui-material/src/locale/heIL.ts +++ b/packages/mui-material/src/locale/heIL.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('he-IL'); export const heIL: Localization = { components: { @@ -24,7 +27,7 @@ export const heIL: Localization = { }, labelRowsPerPage: 'שורות בעמוד:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} מתוך ${count !== -1 ? count : `יותר מ ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} מתוך ${count !== -1 ? formatNumber(count) : `יותר מ ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/hiIN.ts b/packages/mui-material/src/locale/hiIN.ts index 6cafe51b407c23..c510ca545e69a3 100644 --- a/packages/mui-material/src/locale/hiIN.ts +++ b/packages/mui-material/src/locale/hiIN.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('hi-IN'); export const hiIN: Localization = { components: { @@ -24,7 +27,7 @@ export const hiIN: Localization = { }, labelRowsPerPage: 'पंक्तियाँ प्रति पृष्ठ:', labelDisplayedRows: ({ from, to, count }) => - `${from}-${to === -1 ? count : to} कुल ${count} में`, + `${formatNumber(from)}-${to === -1 ? formatNumber(count) : formatNumber(to)} कुल ${formatNumber(count)} में`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/hrHR.ts b/packages/mui-material/src/locale/hrHR.ts index ee6d6bb8c6590d..f0263d21f3373e 100644 --- a/packages/mui-material/src/locale/hrHR.ts +++ b/packages/mui-material/src/locale/hrHR.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('hr-HR'); // Croatian - Hrvatski export const hrHR: Localization = { @@ -25,7 +28,7 @@ export const hrHR: Localization = { }, labelRowsPerPage: 'Redova po stranici:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} od ${count !== -1 ? count : `više nego ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} od ${count !== -1 ? formatNumber(count) : `više nego ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/isIS.ts b/packages/mui-material/src/locale/isIS.ts index 682c7e35247ecf..41a1cea11784b5 100644 --- a/packages/mui-material/src/locale/isIS.ts +++ b/packages/mui-material/src/locale/isIS.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('is-IS'); export const isIS: Localization = { components: { @@ -24,7 +27,7 @@ export const isIS: Localization = { }, labelRowsPerPage: 'Raðir á síðu:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} af ${count !== -1 ? count : `fleiri en ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} af ${count !== -1 ? formatNumber(count) : `fleiri en ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/itIT.ts b/packages/mui-material/src/locale/itIT.ts index 45f825a2c687c8..53e12dc0f05769 100644 --- a/packages/mui-material/src/locale/itIT.ts +++ b/packages/mui-material/src/locale/itIT.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('it-IT'); export const itIT: Localization = { components: { @@ -24,7 +27,7 @@ export const itIT: Localization = { }, labelRowsPerPage: 'Righe per pagina:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} di ${count !== -1 ? count : `più di ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} di ${count !== -1 ? formatNumber(count) : `più di ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/jaJP.ts b/packages/mui-material/src/locale/jaJP.ts index 378be7170b458f..721bfcefc1bd7d 100644 --- a/packages/mui-material/src/locale/jaJP.ts +++ b/packages/mui-material/src/locale/jaJP.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ja-JP'); export const jaJP: Localization = { components: { @@ -24,7 +27,7 @@ export const jaJP: Localization = { }, labelRowsPerPage: 'ページあたりの行数:', labelDisplayedRows: ({ from, to, count }) => - `${from}~${to} / ${count !== -1 ? count : `${to}以上`}`, + `${formatNumber(from)}~${formatNumber(to)} / ${count !== -1 ? formatNumber(count) : `${formatNumber(to)}以上`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/khKH.ts b/packages/mui-material/src/locale/khKH.ts index 83c9f3673721ce..3a8b424d52a83f 100644 --- a/packages/mui-material/src/locale/khKH.ts +++ b/packages/mui-material/src/locale/khKH.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('kh-KH'); export const khKH: Localization = { components: { @@ -24,7 +27,7 @@ export const khKH: Localization = { }, labelRowsPerPage: 'ចំនួនជួរដេកក្នុងមួយទំព័រ:', labelDisplayedRows: ({ from, to, count }) => - `${from} - ${to} នៃ ${count !== -1 ? count : `ច្រើនជាង ${to}`}`, + `${formatNumber(from)} - ${formatNumber(to)} នៃ ${count !== -1 ? formatNumber(count) : `ច្រើនជាង ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/kkKZ.ts b/packages/mui-material/src/locale/kkKZ.ts index 30a5bb1cd64e70..456ef9235dcf93 100644 --- a/packages/mui-material/src/locale/kkKZ.ts +++ b/packages/mui-material/src/locale/kkKZ.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('kk-KZ'); export const kkKZ: Localization = { components: { @@ -24,7 +27,7 @@ export const kkKZ: Localization = { }, labelRowsPerPage: 'Беттегі қатарлар:', labelDisplayedRows: ({ from, to, count }) => - `${count !== -1 ? count : `+${to}`} қатардың ішінен ${from}–${to}`, + `${count !== -1 ? formatNumber(count) : `+${formatNumber(to)}`} қатардың ішінен ${formatNumber(from)}–${formatNumber(to)}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/koKR.ts b/packages/mui-material/src/locale/koKR.ts index f01485c39d487b..e234f0316b54ce 100644 --- a/packages/mui-material/src/locale/koKR.ts +++ b/packages/mui-material/src/locale/koKR.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ko-KR'); export const koKR: Localization = { components: { @@ -24,7 +27,7 @@ export const koKR: Localization = { }, labelRowsPerPage: '페이지 당 행:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} / ${count !== -1 ? count : `${to}개 이상`}`, + `${formatNumber(from)}–${formatNumber(to)} / ${count !== -1 ? formatNumber(count) : `${formatNumber(to)}개 이상`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/kuCKB.ts b/packages/mui-material/src/locale/kuCKB.ts index d8d38a3c9037f0..72444dfe34c01a 100644 --- a/packages/mui-material/src/locale/kuCKB.ts +++ b/packages/mui-material/src/locale/kuCKB.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ku-CKB'); export const kuCKB: Localization = { components: { @@ -24,7 +27,7 @@ export const kuCKB: Localization = { }, labelRowsPerPage: 'ژمارەی ڕیزەکان لە هەر پەڕەیەک:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} لە ${count !== -1 ? count : ` زیاترە لە${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} لە ${count !== -1 ? formatNumber(count) : ` زیاترە لە${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/kuLatn.ts b/packages/mui-material/src/locale/kuLatn.ts index cf690ea39dc816..fa2692a5ac6495 100644 --- a/packages/mui-material/src/locale/kuLatn.ts +++ b/packages/mui-material/src/locale/kuLatn.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ku-Latn'); export const kuLatn: Localization = { components: { @@ -24,7 +27,7 @@ export const kuLatn: Localization = { }, labelRowsPerPage: 'Rêz li ser rûpelê:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} of ${count !== -1 ? count : `zêdetir ji ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} of ${count !== -1 ? formatNumber(count) : `zêdetir ji ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/mkMK.ts b/packages/mui-material/src/locale/mkMK.ts index e018cd1ee4d5af..6a31041de0f27c 100644 --- a/packages/mui-material/src/locale/mkMK.ts +++ b/packages/mui-material/src/locale/mkMK.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('mk-MK'); // Macedonian - Македонски export const mkMK: Localization = { @@ -25,7 +28,7 @@ export const mkMK: Localization = { }, labelRowsPerPage: 'Редови по страница:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} од ${count !== -1 ? count : `повеќе од ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} од ${count !== -1 ? formatNumber(count) : `повеќе од ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/msMS.ts b/packages/mui-material/src/locale/msMS.ts index b061237204a1c1..81e4e04301c85a 100644 --- a/packages/mui-material/src/locale/msMS.ts +++ b/packages/mui-material/src/locale/msMS.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ms-MS'); // Malay-Melayu export const msMS: Localization = { @@ -25,7 +28,7 @@ export const msMS: Localization = { }, labelRowsPerPage: 'Baris setiap halaman:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} daripada ${count !== -1 ? count : `lebih daripada ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} daripada ${count !== -1 ? formatNumber(count) : `lebih daripada ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/myMY.ts b/packages/mui-material/src/locale/myMY.ts index b8c9a93874f838..7521677fc897fb 100644 --- a/packages/mui-material/src/locale/myMY.ts +++ b/packages/mui-material/src/locale/myMY.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('my-MY'); // Myanmar - မြန်မာ export const myMY: Localization = { @@ -25,7 +28,7 @@ export const myMY: Localization = { }, labelRowsPerPage: 'စာမျက်နှာအလိုက် အတန်းများ:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} ၏ ${count !== -1 ? count : `ထက်ပိုပြီး ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} ၏ ${count !== -1 ? formatNumber(count) : `ထက်ပိုပြီး ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/nbNO.ts b/packages/mui-material/src/locale/nbNO.ts index d84397cb45861d..7b2096ff65f08e 100644 --- a/packages/mui-material/src/locale/nbNO.ts +++ b/packages/mui-material/src/locale/nbNO.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('nb-NO'); export const nbNO: Localization = { components: { @@ -24,7 +27,7 @@ export const nbNO: Localization = { }, labelRowsPerPage: 'Rader per side:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} av ${count !== -1 ? count : `mer enn ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} av ${count !== -1 ? formatNumber(count) : `mer enn ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/neNP.ts b/packages/mui-material/src/locale/neNP.ts index 691830e1f5e650..67449eae6bd99a 100644 --- a/packages/mui-material/src/locale/neNP.ts +++ b/packages/mui-material/src/locale/neNP.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ne-NP'); // Nepali-नेपाली export const neNP: Localization = { @@ -25,7 +28,7 @@ export const neNP: Localization = { }, labelRowsPerPage: 'प्रति पृष्ठ पङ्क्तिहरू:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} को ${count !== -1 ? count : `धेरै ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} को ${count !== -1 ? formatNumber(count) : `धेरै ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/nlNL.ts b/packages/mui-material/src/locale/nlNL.ts index ac852382153225..131b26ac940c77 100644 --- a/packages/mui-material/src/locale/nlNL.ts +++ b/packages/mui-material/src/locale/nlNL.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('nl-NL'); export const nlNL: Localization = { components: { @@ -24,7 +27,7 @@ export const nlNL: Localization = { }, labelRowsPerPage: 'Regels per pagina:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} van ${count !== -1 ? count : `meer dan ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} van ${count !== -1 ? formatNumber(count) : `meer dan ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/nnNO.ts b/packages/mui-material/src/locale/nnNO.ts index e713a8a32939f4..59c238e31e771f 100644 --- a/packages/mui-material/src/locale/nnNO.ts +++ b/packages/mui-material/src/locale/nnNO.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('nn-NO'); export const nnNO: Localization = { components: { @@ -24,7 +27,7 @@ export const nnNO: Localization = { }, labelRowsPerPage: 'Rader per side:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} av ${count !== -1 ? count : `fleire enn ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} av ${count !== -1 ? formatNumber(count) : `fleire enn ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/plPL.ts b/packages/mui-material/src/locale/plPL.ts index 8076970a15f319..4283e4719a7699 100644 --- a/packages/mui-material/src/locale/plPL.ts +++ b/packages/mui-material/src/locale/plPL.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('pl-PL'); export const plPL: Localization = { components: { @@ -24,7 +27,7 @@ export const plPL: Localization = { }, labelRowsPerPage: 'Wierszy na stronę:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} z ${count !== -1 ? count : `ponad ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} z ${count !== -1 ? formatNumber(count) : `ponad ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/psAF.ts b/packages/mui-material/src/locale/psAF.ts index 6915bd4f3f5ede..fa854c34d1c2d6 100644 --- a/packages/mui-material/src/locale/psAF.ts +++ b/packages/mui-material/src/locale/psAF.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ps-AF'); export const psAF: Localization = { components: { @@ -24,7 +27,7 @@ export const psAF: Localization = { }, labelRowsPerPage: 'په پاڼه کی د کرښو شمیر', labelDisplayedRows: ({ from, to, count }) => - `${count !== -1 ? count : `${to} زیات له`} ${to}- ${from} د`, + `${count !== -1 ? formatNumber(count) : `${formatNumber(to)} زیات له`} ${formatNumber(to)}- ${formatNumber(from)} د`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/ptBR.ts b/packages/mui-material/src/locale/ptBR.ts index 8ca195f2b7ab21..e1fd17bcd5757f 100644 --- a/packages/mui-material/src/locale/ptBR.ts +++ b/packages/mui-material/src/locale/ptBR.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('pt-BR'); export const ptBR: Localization = { components: { @@ -24,7 +27,7 @@ export const ptBR: Localization = { }, labelRowsPerPage: 'Linhas por página:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} de ${count !== -1 ? count : `mais de ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} de ${count !== -1 ? formatNumber(count) : `mais de ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/ptPT.ts b/packages/mui-material/src/locale/ptPT.ts index 1cd65b60b6a28d..212bb567ee9ec8 100644 --- a/packages/mui-material/src/locale/ptPT.ts +++ b/packages/mui-material/src/locale/ptPT.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('pt-PT'); export const ptPT: Localization = { components: { @@ -24,7 +27,7 @@ export const ptPT: Localization = { }, labelRowsPerPage: 'Linhas por página:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} de ${count !== -1 ? count : `mais de ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} de ${count !== -1 ? formatNumber(count) : `mais de ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/roRO.ts b/packages/mui-material/src/locale/roRO.ts index 01684b3e6dfcf5..e50ce6e9419dfd 100644 --- a/packages/mui-material/src/locale/roRO.ts +++ b/packages/mui-material/src/locale/roRO.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ro-RO'); export const roRO: Localization = { components: { @@ -24,7 +27,7 @@ export const roRO: Localization = { }, labelRowsPerPage: 'Rânduri pe pagină:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} din ${count !== -1 ? count : `mai mult de ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} din ${count !== -1 ? formatNumber(count) : `mai mult de ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/ruRU.ts b/packages/mui-material/src/locale/ruRU.ts index d94a0888116be4..0db56425c01b89 100644 --- a/packages/mui-material/src/locale/ruRU.ts +++ b/packages/mui-material/src/locale/ruRU.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ru-RU'); export const ruRU: Localization = { components: { @@ -24,7 +27,7 @@ export const ruRU: Localization = { }, labelRowsPerPage: 'Строк на странице:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} из ${count !== -1 ? count : `более чем ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} из ${count !== -1 ? formatNumber(count) : `более чем ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/siLK.ts b/packages/mui-material/src/locale/siLK.ts index 51668c630a13ba..3169d37b22a5f5 100644 --- a/packages/mui-material/src/locale/siLK.ts +++ b/packages/mui-material/src/locale/siLK.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('si-LK'); export const siLK: Localization = { components: { @@ -24,7 +27,7 @@ export const siLK: Localization = { }, labelRowsPerPage: 'පිටුවක පේළි:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} දක්වා ${count !== -1 ? count : `${to} ට වැඩි ප්‍රමාණයකින්`}`, + `${formatNumber(from)}–${formatNumber(to)} දක්වා ${count !== -1 ? formatNumber(count) : `${formatNumber(to)} ට වැඩි ප්‍රමාණයකින්`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/skSK.ts b/packages/mui-material/src/locale/skSK.ts index 77f7368cf01f3c..d81897c15ebc87 100644 --- a/packages/mui-material/src/locale/skSK.ts +++ b/packages/mui-material/src/locale/skSK.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('sk-SK'); export const skSK: Localization = { components: { @@ -24,7 +27,7 @@ export const skSK: Localization = { }, labelRowsPerPage: 'Riadkov na stránke:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} z ${count !== -1 ? count : `viac ako ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} z ${count !== -1 ? formatNumber(count) : `viac ako ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/srRS.ts b/packages/mui-material/src/locale/srRS.ts index b17f6d6d6eb666..98a1a3ebe96fbd 100644 --- a/packages/mui-material/src/locale/srRS.ts +++ b/packages/mui-material/src/locale/srRS.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('sr-RS'); // Serbian - Srpski export const srRS: Localization = { @@ -25,7 +28,7 @@ export const srRS: Localization = { }, labelRowsPerPage: 'Redova po stranici:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} od ${count !== -1 ? count : `više nego ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} od ${count !== -1 ? formatNumber(count) : `više nego ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/svSE.ts b/packages/mui-material/src/locale/svSE.ts index 8970ee31352b1e..9f9af994bd2dc0 100644 --- a/packages/mui-material/src/locale/svSE.ts +++ b/packages/mui-material/src/locale/svSE.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('sv-SE'); export const svSE: Localization = { components: { @@ -24,7 +27,7 @@ export const svSE: Localization = { }, labelRowsPerPage: 'Rader per sida:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} av ${count !== -1 ? count : `fler än ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} av ${count !== -1 ? formatNumber(count) : `fler än ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/thTH.ts b/packages/mui-material/src/locale/thTH.ts index ec1d8e5321b97b..f575b2ffd2d857 100644 --- a/packages/mui-material/src/locale/thTH.ts +++ b/packages/mui-material/src/locale/thTH.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('th-TH'); export const thTH: Localization = { components: { @@ -24,7 +27,7 @@ export const thTH: Localization = { }, labelRowsPerPage: 'จำนวนแถวต่อหน้า:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} จาก ${count !== -1 ? count : `มากกว่า ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} จาก ${count !== -1 ? formatNumber(count) : `มากกว่า ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/tlTL.ts b/packages/mui-material/src/locale/tlTL.ts index 633053128d2d3d..1d6d4590462cc5 100644 --- a/packages/mui-material/src/locale/tlTL.ts +++ b/packages/mui-material/src/locale/tlTL.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('tl-TL'); // Tagalog-Tagalog export const tlTL: Localization = { @@ -25,7 +28,7 @@ export const tlTL: Localization = { }, labelRowsPerPage: 'Mga hilera bawat pahina:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} ng ${count !== -1 ? count : `higit sa ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} ng ${count !== -1 ? formatNumber(count) : `higit sa ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/trTR.ts b/packages/mui-material/src/locale/trTR.ts index b6a6e0ffb43f63..dadbe0bcd2d64b 100644 --- a/packages/mui-material/src/locale/trTR.ts +++ b/packages/mui-material/src/locale/trTR.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('tr-TR'); export const trTR: Localization = { components: { @@ -24,7 +27,7 @@ export const trTR: Localization = { }, labelRowsPerPage: 'Sayfa başına satır:', labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} / ${count !== -1 ? count : `${to}'den fazla`}`, + `${formatNumber(from)}-${formatNumber(to)} / ${count !== -1 ? formatNumber(count) : `${formatNumber(to)}'den fazla`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/ukUA.ts b/packages/mui-material/src/locale/ukUA.ts index 441694dfd2bea1..527db3ceb78b25 100644 --- a/packages/mui-material/src/locale/ukUA.ts +++ b/packages/mui-material/src/locale/ukUA.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('uk-UA'); export const ukUA: Localization = { components: { @@ -24,7 +27,7 @@ export const ukUA: Localization = { }, labelRowsPerPage: 'Рядків на сторінці:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} з ${count !== -1 ? count : `понад ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} з ${count !== -1 ? formatNumber(count) : `понад ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/urPK.ts b/packages/mui-material/src/locale/urPK.ts index 4cbe9ab9081995..39ebaab9021852 100644 --- a/packages/mui-material/src/locale/urPK.ts +++ b/packages/mui-material/src/locale/urPK.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('ur-PK'); export const urPK: Localization = { components: { @@ -24,7 +27,7 @@ export const urPK: Localization = { }, labelRowsPerPage: 'ایک صفحے پر قطاریں:', labelDisplayedRows: ({ from, to, count }) => - `${count !== -1 ? `${count} میں سے` : `${to} سے ذیادہ میں سے`} ${from} سے ${to} قطاریں`, + `${count !== -1 ? `${formatNumber(count)} میں سے` : `${formatNumber(to)} سے ذیادہ میں سے`} ${formatNumber(from)} سے ${formatNumber(to)} قطاریں`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/utils/formatNumber.ts b/packages/mui-material/src/locale/utils/formatNumber.ts new file mode 100644 index 00000000000000..c0411b0211e0b2 --- /dev/null +++ b/packages/mui-material/src/locale/utils/formatNumber.ts @@ -0,0 +1,21 @@ +export const formatNumber = (value: number | string, locale?: string): string => { + const numValue = typeof value === 'string' ? Number(value) : value; + + if (!Number.isFinite(numValue)) { + return String(value); + } + + if (typeof Intl !== 'undefined' && Intl.NumberFormat) { + try { + return new Intl.NumberFormat(locale).format(numValue); + } catch { + return String(numValue); + } + } + + return String(numValue); +}; + +export const buildFormatNumber = (locale: string) => { + return (value: number | string) => formatNumber(value, locale); +}; diff --git a/packages/mui-material/src/locale/viVN.ts b/packages/mui-material/src/locale/viVN.ts index 949f2827d41ac2..a54e4c684c79b1 100644 --- a/packages/mui-material/src/locale/viVN.ts +++ b/packages/mui-material/src/locale/viVN.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('vi-VN'); export const viVN: Localization = { components: { @@ -24,7 +27,7 @@ export const viVN: Localization = { }, labelRowsPerPage: 'Số hàng mỗi trang:', labelDisplayedRows: ({ from, to, count }) => - `${from}–${to} trong ${count !== -1 ? count : `nhiều hơn ${to}`}`, + `${formatNumber(from)}–${formatNumber(to)} trong ${count !== -1 ? formatNumber(count) : `nhiều hơn ${formatNumber(to)}`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/zhCN.ts b/packages/mui-material/src/locale/zhCN.ts index 809862ec634640..fddb13c993ac9f 100644 --- a/packages/mui-material/src/locale/zhCN.ts +++ b/packages/mui-material/src/locale/zhCN.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('zh-CN'); export const zhCN: Localization = { components: { @@ -23,7 +26,7 @@ export const zhCN: Localization = { }, labelRowsPerPage: '每页行数:', labelDisplayedRows: ({ from, to, count }) => - `第 ${from} 条到第 ${to} 条,${count !== -1 ? `共 ${count} 条` : `至少 ${to} 条`}`, + `第 ${formatNumber(from)} 条到第 ${formatNumber(to)} 条,${count !== -1 ? `共 ${formatNumber(count)} 条` : `至少 ${formatNumber(to)} 条`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/zhHK.ts b/packages/mui-material/src/locale/zhHK.ts index ed13ec996368ee..d104c23fd8b709 100644 --- a/packages/mui-material/src/locale/zhHK.ts +++ b/packages/mui-material/src/locale/zhHK.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('zh-HK'); export const zhHK: Localization = { components: { @@ -23,7 +26,7 @@ export const zhHK: Localization = { }, labelRowsPerPage: '每頁行數:', labelDisplayedRows: ({ from, to, count }) => - `第 ${from} 項至第 ${to} 項,${count !== -1 ? `共 ${count} 項` : `超過 ${to} 項`}`, + `第 ${formatNumber(from)} 項至第 ${formatNumber(to)} 項,${count !== -1 ? `共 ${formatNumber(count)} 項` : `超過 ${formatNumber(to)} 項`}`, }, }, MuiRating: { diff --git a/packages/mui-material/src/locale/zhTW.ts b/packages/mui-material/src/locale/zhTW.ts index ecdc6b70a59082..45f8f375dbdcda 100644 --- a/packages/mui-material/src/locale/zhTW.ts +++ b/packages/mui-material/src/locale/zhTW.ts @@ -1,4 +1,7 @@ import type { Localization } from './utils/LocaleTextApi'; +import { buildFormatNumber } from './utils/formatNumber'; + +const formatNumber = buildFormatNumber('zh-TW'); export const zhTW: Localization = { components: { @@ -23,7 +26,7 @@ export const zhTW: Localization = { }, labelRowsPerPage: '每頁數量:', labelDisplayedRows: ({ from, to, count }) => - `${from} ~ ${to} / ${count !== -1 ? count : `${to} 以上`}`, + `${formatNumber(from)} ~ ${formatNumber(to)} / ${count !== -1 ? formatNumber(count) : `${formatNumber(to)} 以上`}`, }, }, MuiRating: {