This repository has been archived by the owner on Jun 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(front-end): Add Spanish translation for mat-paginator
- Loading branch information
1 parent
b62fc79
commit 89ec013
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Kaizen/ClientApp/src/app/core/utils/spanish-mat-paginator-intl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { MatPaginatorIntl } from '@angular/material/paginator'; | ||
|
||
const spanishRangeLabel = (page: number, pageSize: number, length: number) => { | ||
if (length == 0 || pageSize == 0) { | ||
return `0 de ${ length }`; | ||
} | ||
|
||
length = Math.max(length, 0); | ||
|
||
const startIndex = page * pageSize; | ||
|
||
// If the start index exceeds the list length, do not try and fix the end index to the end. | ||
const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize; | ||
|
||
return `${ startIndex + 1 } - ${ endIndex } de ${ length }`; | ||
}; | ||
|
||
export function getSpanishPaginatorIntl() { | ||
const paginatorIntl = new MatPaginatorIntl(); | ||
|
||
paginatorIntl.itemsPerPageLabel = 'Elementos por página:'; | ||
paginatorIntl.nextPageLabel = 'Siguiente página'; | ||
paginatorIntl.previousPageLabel = 'Pagina anterior'; | ||
paginatorIntl.getRangeLabel = spanishRangeLabel; | ||
|
||
return paginatorIntl; | ||
} |