Skip to content

Commit 4c3bbfa

Browse files
NguyenThuyLanLan Nguyen ThuyiOvergaard
authored
feat: adds localization to uui-pagination (#1069)
* Fix localization of uui-pagination * Remove getter setter from properties * change type of labels to accepts an argument * remove method arguments --------- Co-authored-by: Lan Nguyen Thuy <[email protected]> Co-authored-by: Jacob Overgaard <[email protected]>
1 parent 12cc5bc commit 4c3bbfa

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

packages/uui-pagination/lib/uui-pagination.element.ts

+39-16
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,37 @@ export class UUIPaginationElement extends LitElement {
126126
@property({ reflect: true, attribute: 'aria-label' })
127127
ariaLabel = '';
128128

129+
/**
130+
* This property is used to generate the name of the first button
131+
* @type {string}
132+
* @attr
133+
*/
134+
@property()
135+
firstLabel: string = 'First';
136+
137+
/**
138+
* This property is used to generate the name of the previous button
139+
* @type {string}
140+
* @attr
141+
*/
142+
@property()
143+
previousLabel: string = 'Previous';
144+
145+
/**
146+
* This property is used to generate the name of the next button
147+
* @type {string}
148+
* @attr
149+
*/
150+
@property()
151+
nextLabel: string = 'Next';
152+
/**
153+
* This property is used to generate the name of the last button
154+
* @type {string}
155+
* @attr
156+
*/
157+
@property()
158+
lastLabel: string = 'Last';
159+
129160
private _total = 100;
130161

131162
/**
@@ -214,11 +245,9 @@ export class UUIPaginationElement extends LitElement {
214245
look="outline"
215246
class="nav"
216247
role="listitem"
217-
label="Go to first page"
248+
label=${this.firstLabel}
218249
?disabled=${this._current === 1}
219-
@click=${() => this.goToPage(1)}>
220-
First
221-
</uui-button>`;
250+
@click=${() => this.goToPage(1)}></uui-button>`;
222251
}
223252

224253
protected renderPrevious() {
@@ -227,11 +256,9 @@ export class UUIPaginationElement extends LitElement {
227256
look="outline"
228257
class="nav"
229258
role="listitem"
230-
label="Go to previous page"
259+
label=${this.previousLabel}
231260
?disabled=${this._current === 1}
232-
@click=${this.goToPreviousPage}>
233-
Previous
234-
</uui-button>`;
261+
@click=${this.goToPreviousPage}></uui-button>`;
235262
}
236263

237264
protected renderNext() {
@@ -240,11 +267,9 @@ export class UUIPaginationElement extends LitElement {
240267
look="outline"
241268
role="listitem"
242269
class="nav"
243-
label="Go to next page"
270+
label=${this.nextLabel}
244271
?disabled=${this._current === this.total}
245-
@click=${this.goToNextPage}>
246-
Next
247-
</uui-button>`;
272+
@click=${this.goToNextPage}></uui-button>`;
248273
}
249274

250275
protected renderLast() {
@@ -254,11 +279,9 @@ export class UUIPaginationElement extends LitElement {
254279
look="outline"
255280
role="listitem"
256281
class="nav"
257-
label="Go to last page"
282+
label=${this.lastLabel}
258283
?disabled=${this.total === this._current}
259-
@click=${() => this.goToPage(this.total)}>
260-
Last
261-
</uui-button>
284+
@click=${() => this.goToPage(this.total)}></uui-button>
262285
`;
263286
}
264287

0 commit comments

Comments
 (0)