Solvedcomponents [Paginator] Unclear in docs about how to set language
✔️Accepted Answer
//Atribute
@ViewChild(MatPaginator) paginator: MatPaginator;
ngOnInit(){
...
this.paginator._intl.itemsPerPageLabel = 'My translation for items per page.';
...
}
Other Answers:
@katrina-engelbrecht the docs briefly mention it at the bottom of the paginator overview, but I don't feel like it's entirely clear. Here's an example
https://plnkr.co/edit/Zy0kOh78CBelkBH8VEug?p=preview
Note that you must be using the latest builds or wait until the next beta release since MdPaginatorIntl
was just recently exposed.
@andrewseguin maybe additional docs will show a better way but I feel like it's clunky to override all the properties or extend the whole class when you're trying to change the text for all 4 labels. I'm wondering if MdPaginatorIntl could benefit from a constructor,
export const customPaginatorIntl = new MdPaginatorIntl(
'Items per page',
'Next page',
'Previous page',
(page, size, length) => `Page ${page} of ${length / size}`
);
Bug, feature request, or proposal:
I want to set the paginator to german language. How can I do it???