Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added rowsPerPage label and its translation #9328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/ra-core/src/i18n/TranslationMessages.ts
Expand Up @@ -181,6 +181,12 @@ export interface TranslationMessages extends StringMap {
remove_message: string;
help: string;
};
rowCount: {
per_page_5: string;
per_page_10: string;
per_page_25: string;
per_page_50: string;
};
configurable?: {
customize: string;
configureMode: string;
Expand Down
6 changes: 6 additions & 0 deletions packages/ra-language-english/src/index.ts
Expand Up @@ -185,6 +185,12 @@ const englishMessages: TranslationMessages = {
'Are you sure you want to remove that item from your list of saved queries?',
help: 'Filter the list and save this query for later',
},
rowCount: {
per_page_5: '5 per page',
per_page_10: '10 per page',
per_page_25: '25 per page',
per_page_50: '50 per page',
},
configurable: {
customize: 'Customize',
configureMode: 'Configure this page',
Expand Down
6 changes: 6 additions & 0 deletions packages/ra-language-french/src/index.ts
Expand Up @@ -192,6 +192,12 @@ const frenchMessages: TranslationMessages = {
'Etes-vous sûr(e) de vouloir supprimer cette requête de votre liste de requêtes ?',
help: 'Filtrez la liste et ajoutez cette requête à votre liste',
},
rowCount: {
per_page_5: '5 par page',
per_page_10: '10 par page',
per_page_25: '25 par page',
per_page_50: '50 par page',
},
configurable: {
customize: 'Personnaliser',
configureMode: 'Configurer cette page',
Expand Down
12 changes: 8 additions & 4 deletions packages/ra-ui-materialui/src/list/pagination/Pagination.tsx
Expand Up @@ -19,6 +19,14 @@ import {
import { PaginationActions, PaginationActionsProps } from './PaginationActions';

export const Pagination: FC<PaginationProps> = memo(props => {
const translate = useTranslate();
const DefaultRowsPerPageOptions = [
{ label: translate('ra.rowCount.per_page_5'), value: 5 },
{ label: translate('ra.rowCount.per_page_10'), value: 10 },
{ label: translate('ra.rowCount.per_page_25'), value: 25 },
{ label: translate('ra.rowCount.per_page_50'), value: 50 },
];
const emptyArray = [];
const {
rowsPerPageOptions = DefaultRowsPerPageOptions,
actions,
Expand All @@ -34,7 +42,6 @@ export const Pagination: FC<PaginationProps> = memo(props => {
setPage,
setPerPage,
} = useListPaginationContext(props);
const translate = useTranslate();
const isSmall = useMediaQuery((theme: Theme) =>
theme.breakpoints.down('md')
);
Expand Down Expand Up @@ -153,9 +160,6 @@ Pagination.propTypes = {
rowsPerPageOptions: PropTypes.arrayOf(PropTypes.number),
};

const DefaultRowsPerPageOptions = [5, 10, 25, 50];
const emptyArray = [];

export interface PaginationProps
extends TablePaginationBaseProps,
Partial<ListPaginationContextValue> {
Expand Down