Skip to content

Commit

Permalink
feat: i18n pageable
Browse files Browse the repository at this point in the history
  • Loading branch information
69pmb committed Feb 25, 2024
1 parent 25b841f commit c297444
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {MatSortModule} from '@angular/material/sort';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {MatSelectModule} from '@angular/material/select';
import {MatRippleModule} from '@angular/material/core';
import {MatPaginatorModule} from '@angular/material/paginator';
import {
MatPaginatorIntl,
MatPaginatorModule,
} from '@angular/material/paginator';
import {MatMenuModule} from '@angular/material/menu';
import {MatInputModule} from '@angular/material/input';
import {MatFormFieldModule} from '@angular/material/form-field';
Expand Down Expand Up @@ -59,6 +62,21 @@ bootstrapApplication(AppComponent, {
registrationStrategy: 'registerWhenStable:30000',
})
),
{
provide: MatPaginatorIntl,
useFactory: (): MatPaginatorIntl => {
const int = new MatPaginatorIntl();
int.itemsPerPageLabel = 'Élements par page';
int.nextPageLabel = 'Page suivante';
int.previousPageLabel = 'Page précédente';
int.firstPageLabel = '1ère page';
int.lastPageLabel = 'Dernière page';
const e = int.getRangeLabel;
int.getRangeLabel = (page: number, pageSize: number, length: number) =>
e(page, pageSize, length).replace('of', 'sur');
return int;
},
},
provideAnimations(),
provideHttpClient(withInterceptorsFromDi()),
],
Expand Down

0 comments on commit c297444

Please sign in to comment.