Skip to content

Commit 8079649

Browse files
committed
chore(*): use common resource strings
1 parent 58af112 commit 8079649

File tree

2 files changed

+22
-55
lines changed

2 files changed

+22
-55
lines changed

projects/igniteui-angular/src/lib/paginator/paginator.component.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
<div class="igx-paginator__select" [hidden]="dropdownHidden">
2-
<label class="igx-paginator__label">{{ selectLabel }}</label>
2+
<label class="igx-paginator__label">{{ resourceStrings.igx_paginator_label }}</label>
33
<div class="igx-paginator__select-input">
44
<igx-select [(ngModel)]="perPage" [displayDensity]="paginatorSelectDisplayDensity()" type="border"
55
[disabled]="!dropdownEnabled">
6-
<label igxLabel [hidden]="true">{{ selectLabel }}</label>
6+
<label igxLabel [hidden]="true">{{ resourceStrings.igx_paginator_label }}</label>
77
<igx-select-item [value]="val" *ngFor="let val of selectOptions">
88
{{val}}
99
</igx-select-item>
1010
</igx-select>
1111
</div>
1212
</div>
1313
<div class="igx-paginator__pager" [hidden]="pagerHidden" role="navigation">
14-
<button [title]="firstPageLabel" [disabled]="isFirstPageDisabled" [attr.aria-disabled]="isFirstPageDisabled" (click)="paginate(0)" igxButton="icon" igxRipple igxRippleCentered="true">
14+
<button [title]="resourceStrings.igx_paginator_first_page_button_text" [disabled]="isFirstPageDisabled" [attr.aria-disabled]="isFirstPageDisabled" (click)="paginate(0)" igxButton="icon" igxRipple igxRippleCentered="true">
1515
<igx-icon fontSet="material">first_page</igx-icon>
1616
</button>
17-
<button [title]="previousPageLabel" [disabled]="isFirstPageDisabled" [attr.aria-disabled]="isFirstPageDisabled" (click)="previousPage()" igxButton="icon" igxRipple igxRippleCentered="true">
17+
<button [title]="resourceStrings.igx_paginator_previous_page_button_text" [disabled]="isFirstPageDisabled" [attr.aria-disabled]="isFirstPageDisabled" (click)="previousPage()" igxButton="icon" igxRipple igxRippleCentered="true">
1818
<igx-icon fontSet="material">chevron_left</igx-icon>
1919
</button>
2020
<div class='igx-paginator__pager-text' aria-current="page">
2121
<span>{{ page + 1 }}</span>
22-
<span>&nbsp;{{prepositionPage}}&nbsp;</span>
22+
<span>&nbsp;{{ resourceStrings.igx_paginator_pager_text }}&nbsp;</span>
2323
<span>{{ totalPages }}</span>
2424
</div>
25-
<button [title]="nextPageLabel" [disabled]="isLastPageDisabled" [attr.aria-disabled]="isLastPageDisabled" (click)="nextPage()" igxRipple igxRippleCentered="true" igxButton="icon">
25+
<button [title]="resourceStrings.igx_paginator_next_page_button_text" [disabled]="isLastPageDisabled" [attr.aria-disabled]="isLastPageDisabled" (click)="nextPage()" igxRipple igxRippleCentered="true" igxButton="icon">
2626
<igx-icon fontSet="material">chevron_right</igx-icon>
2727
</button>
28-
<button [title]="lastPageLabel" [disabled]="isLastPageDisabled" [attr.aria-disabled]="isLastPageDisabled" (click)="paginate(totalPages - 1)" igxButton="icon" igxRipple
28+
<button [title]="resourceStrings.igx_paginator_last_page_button_text" [disabled]="isLastPageDisabled" [attr.aria-disabled]="isLastPageDisabled" (click)="paginate(totalPages - 1)" igxButton="icon" igxRipple
2929
igxRippleCentered="true">
3030
<igx-icon fontSet="material">last_page</igx-icon>
3131
</button>

projects/igniteui-angular/src/lib/paginator/paginator.component.ts

Lines changed: 15 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { IgxIconModule } from '../icon/index';
88
import { IgxButtonModule } from '../directives/button/button.directive';
99
import { IgxRippleModule } from '../directives/ripple/ripple.directive';
1010
import { IgxInputGroupModule } from '../input-group';
11+
import { IPaginatorResourceStrings } from '../core/i18n/paginator-resources';
1112

1213
@Component({
1314
selector: 'igx-paginator',
@@ -19,6 +20,7 @@ export class IgxPaginatorComponent extends DisplayDensityBase {
1920
* Total pages calculated from totalRecords and perPage
2021
*/
2122
public totalPages: number;
23+
private _resourceStrings = CurrentResourceStrings.PaginatorResStrings;
2224
protected _page = 0;
2325
protected _totalRecords: number;
2426
protected _selectOptions;
@@ -159,56 +161,21 @@ export class IgxPaginatorComponent extends DisplayDensityBase {
159161
@Input()
160162
public dropdownHidden = false;
161163

162-
/**
163-
* An @Input property, sets number of label of the select.
164-
* The default is 'Items per page' localized string.
165-
* ```html
166-
* <igx-paginator label="My custom label"></igx-paginator>
167-
* ```
168-
* @memberof IgxPaginatorComponent
169-
*/
164+
/**
165+
* An accessor that sets the resource strings.
166+
* By default it uses EN resources.
167+
*/
170168
@Input()
171-
public selectLabel = CurrentResourceStrings.PaginatorResStrings.igx_paginator_label;
172-
173-
/**
174-
* An @Input property, sets a preposition between the current page and total pages.
175-
* The default is 'of' localized string.
176-
* @memberof IgxPaginatorComponent
177-
*/
178-
@Input()
179-
public prepositionPage = CurrentResourceStrings.PaginatorResStrings.igx_paginator_pager_text;
180-
181-
/**
182-
* An @Input property, sets a tooltip text for first page button label
183-
* The default is 'Go to first page' localized string.
184-
* @memberof IgxPaginatorComponent
185-
*/
186-
@Input()
187-
public firstPageLabel = CurrentResourceStrings.PaginatorResStrings.igx_paginator_first_page_button_text;
188-
189-
/**
190-
* An @Input property, sets a tooltip text for the previous page button label
191-
* The default is 'Previous page' localized string.
192-
* @memberof IgxPaginatorComponent
193-
*/
194-
@Input()
195-
public previousPageLabel = CurrentResourceStrings.PaginatorResStrings.igx_paginator_previous_page_button_text;
196-
197-
/**
198-
* An @Input property, sets a tooltip text for last page button label
199-
* The default is 'Go to last page' localized string.
200-
* @memberof IgxPaginatorComponent
201-
*/
202-
@Input()
203-
public lastPageLabel = CurrentResourceStrings.PaginatorResStrings.igx_paginator_last_page_button_text;
169+
set resourceStrings(value: IPaginatorResourceStrings) {
170+
this._resourceStrings = Object.assign({}, this._resourceStrings, value);
171+
}
204172

205-
/**
206-
* An @Input property, sets a tooltip text for the next page button label
207-
* The default is 'Next page' localized string.
208-
* @memberof IgxPaginatorComponent
209-
*/
210-
@Input()
211-
public nextPageLabel = CurrentResourceStrings.PaginatorResStrings.igx_paginator_next_page_button_text;
173+
/**
174+
* An accessor that returns the resource strings.
175+
*/
176+
get resourceStrings(): IPaginatorResourceStrings {
177+
return this._resourceStrings;
178+
}
212179

213180
/**
214181
* An event that is emitted when the select in the `IgxPaginatorComponent` changes its value.

0 commit comments

Comments
 (0)