@@ -179,7 +179,7 @@ import { I18n } from "./../i18n/i18n.module";
179179 [size]="size !== ('lg' ? 'sm' : 'md')"
180180 [(ngModel)]="selectAllCheckbox"
181181 [indeterminate]="selectAllCheckboxSomeSelected"
182- aria-label="Select all rows "
182+ [attr. aria-label]="checkboxHeaderLabel | async "
183183 (change)="onSelectAllCheckboxChange()">
184184 </ibm-checkbox>
185185 </th>
@@ -200,7 +200,7 @@ import { I18n } from "./../i18n/i18n.module";
200200 <button
201201 class="bx--table-sort-v2"
202202 *ngIf="this.sort.observers.length > 0 && column.sortable"
203- [attr.aria-label]="(column.sorted && column.ascending ? sortDescendingLabel : sortAscendingLabel)"
203+ [attr.aria-label]="(column.sorted && column.ascending ? sortDescendingLabel : sortAscendingLabel) | async "
204204 aria-live="polite"
205205 [ngClass]="{
206206 'bx--table-sort-v2--active': column.sorted,
@@ -233,7 +233,7 @@ import { I18n } from "./../i18n/i18n.module";
233233 aria-haspopup="true"
234234 [ibmTooltip]="column.filterTemplate"
235235 trigger="click"
236- [title]="translations.FILTER "
236+ [title]="filterTitle | async "
237237 placement="bottom,top"
238238 [data]="column.filterData">
239239 <svg
@@ -308,7 +308,7 @@ import { I18n } from "./../i18n/i18n.module";
308308 <button
309309 *ngIf="model.isRowExpandable(i)"
310310 (click)="model.expandRow(i, !model.rowsExpanded[i])"
311- [attr.aria-label]="expandButtonAriaLabel"
311+ [attr.aria-label]="expandButtonAriaLabel | async "
312312 class="bx--table-expand-v2__button">
313313 <svg class="bx--table-expand-v2__svg" width="7" height="12" viewBox="0 0 7 12">
314314 <path fill-rule="nonzero" d="M5.569 5.994L0 .726.687 0l6.336 5.994-6.335 6.002L0 11.27z" />
@@ -318,11 +318,11 @@ import { I18n } from "./../i18n/i18n.module";
318318 <td *ngIf="!skeleton && showSelectionColumn">
319319 <ibm-checkbox
320320 inline="true"
321- aria-label="Select row "
321+ [attr. aria-label]="checkboxRowLabel | async "
322322 [size]="size !== ('lg' ? 'sm' : 'md')"
323323 [(ngModel)]="model.rowsSelected[i]"
324324 (change)="onRowCheckboxChange(i)">
325- < /ibm-checkbox>
325+ > /ibm-checkbox>
326326 </td>
327327 <ng-container *ngFor="let item of row; let i = index">
328328 <td *ngIf="model.header[i].visible"
@@ -358,9 +358,9 @@ import { I18n } from "./../i18n/i18n.module";
358358 </tr>
359359 <tr *ngIf="this.model.isEnd">
360360 <td class="table_end-indicator">
361- <h5>{{translations.END_OF_DATA }}</h5>
361+ <h5>{{endOfDataText | async }}</h5>
362362 <button (click)="scrollToTop($event)" class="btn--secondary-sm">
363- {{translations.SCROLL_TOP }}
363+ {{scrollTopText | async }}
364364 </button>
365365 </td>
366366 </tr>
@@ -411,11 +411,6 @@ export class Table {
411411 * Set to `true` for a loading table.
412412 */
413413 @Input ( ) skeleton = false ;
414- /**
415- * Object of all the strings table needs.
416- * Defaults to the `TABLE` value from the i18n service.
417- */
418- @Input ( ) translations = this . i18n . get ( ) . TABLE ;
419414
420415 /**
421416 * `TableModel` with data the table is to display.
@@ -499,9 +494,64 @@ export class Table {
499494 */
500495 @Input ( ) columnsDraggable = false ;
501496
502- @Input ( ) expandButtonAriaLabel = "Expand row" ;
503- @Input ( ) sortDescendingLabel = "Sort rows by this header in descending order" ;
504- @Input ( ) sortAscendingLabel = "Sort rows by this header in ascending order" ;
497+ @Input ( )
498+ set expandButtonAriaLabel ( value ) {
499+ this . _expandButtonAriaLabel . next ( value ) ;
500+ }
501+ get expandButtonAriaLabel ( ) {
502+ return this . _expandButtonAriaLabel ;
503+ }
504+ @Input ( )
505+ set sortDescendingLabel ( value ) {
506+ this . _sortDescendingLabel . next ( value ) ;
507+ }
508+ get sortDescendingLabel ( ) {
509+ return this . _sortDescendingLabel ;
510+ }
511+ @Input ( )
512+ set sortAscendingLabel ( value ) {
513+ this . _sortAscendingLabel . next ( value ) ;
514+ }
515+ get sortAscendingLabel ( ) {
516+ return this . _sortAscendingLabel ;
517+ }
518+
519+ /**
520+ * Expects an object that contains some or all of:
521+ * ```
522+ * {
523+ * "FILTER": "Filter",
524+ * "END_OF_DATA": "You've reached the end of your content",
525+ * "SCROLL_TOP": "Scroll to top",
526+ * "CHECKBOX_HEADER": "Select all rows",
527+ * "CHECKBOX_ROW": "Select row"
528+ * }
529+ * ```
530+ */
531+ @Input ( )
532+ set translations ( value ) {
533+ if ( value . FILTER ) {
534+ this . filterTitle . next ( value . FILTER ) ;
535+ }
536+ if ( value . END_OF_DATA ) {
537+ this . endOfDataText . next ( value . END_OF_DATA ) ;
538+ }
539+ if ( value . SCROLL_TOP ) {
540+ this . scrollTopText . next ( value . SCROLL_TOP ) ;
541+ }
542+ if ( value . CHECKBOX_HEADER ) {
543+ this . checkboxHeaderLabel . next ( value . CHECKBOX_HEADER ) ;
544+ }
545+ if ( value . CHECKBOX_ROW ) {
546+ this . checkboxRowLabel . next ( value . CHECKBOX_ROW ) ;
547+ }
548+ }
549+
550+ checkboxHeaderLabel = this . i18n . get ( "TABLE.CHECKBOX_HEADER" ) ;
551+ checkboxRowLabel = this . i18n . get ( "TABLE.CHECKBOX_ROW" ) ;
552+ endOfDataText = this . i18n . get ( "TABLE.END_OF_DATA" ) ;
553+ scrollTopText = this . i18n . get ( "TABLE.SCROLL_TOP" ) ;
554+ filterTitle = this . i18n . get ( "TABLE.FILTER" ) ;
505555
506556 /**
507557 * Controls if all checkboxes are viewed as selected.
@@ -582,6 +632,10 @@ export class Table {
582632
583633 protected _model : TableModel ;
584634
635+ protected _expandButtonAriaLabel = this . i18n . get ( "TABLE.EXPAND_BUTTON" ) ;
636+ protected _sortDescendingLabel = this . i18n . get ( "TABLE.SORT_DESCENDING" ) ;
637+ protected _sortAscendingLabel = this . i18n . get ( "TABLE.SORT_ASCENDING" ) ;
638+
585639 protected columnResizeWidth : number ;
586640 protected columnResizeMouseX : number ;
587641 protected mouseMoveSubscription : Subscription ;
0 commit comments