[i18n] Translate sortable_column (#28648)

* localize sortable_column.js

* Fix typos
This commit is contained in:
Ahmad Bamieh 2019-01-23 04:11:16 -08:00 committed by Maryia Lapata
parent c25fbd323f
commit bc6bdb4574

View file

@ -22,7 +22,7 @@ import template from './sortable_column.html';
const app = uiModules.get('kibana');
app.directive('sortableColumn', function () {
app.directive('sortableColumn', function (i18n) {
return {
restrict: 'E',
transclude: true,
@ -45,8 +45,17 @@ app.directive('sortableColumn', function () {
}
getAriaLabel() {
const direction = this.isSortedAscending() ? 'descending' : 'ascending';
return `Sort ${this.field} ${direction}`;
const isAscending = this.isSortedAscending();
if(isAscending) {
return i18n('common.ui.sortableColumn.sortAscendingAriaLabel', {
defaultMessage: 'Sort {field} ascending',
values: { field: this.field },
});
}
return i18n('common.ui.sortableColumn.sortDescendingAriaLabel', {
defaultMessage: 'Sort {field} descending',
values: { field: this.field },
});
}
isSorted() {