diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index bd1507e2eee0..1819256bab0c 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -34,6 +34,7 @@ import type { HaCheckbox } from "../ha-checkbox"; import "../ha-svg-icon"; import "../search-input"; import { filterData, sortData } from "./sort-filter"; +import { LocalizeFunc } from "../../common/translations/localize"; export interface RowClickedEvent { id: string; @@ -110,6 +111,8 @@ const UNDEFINED_GROUP_KEY = "zzzzz_undefined"; export class HaDataTable extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + @property({ attribute: false }) public localizeFunc?: LocalizeFunc; + @property({ type: Boolean }) public narrow = false; @property({ type: Object }) public columns: DataTableColumnContainer = {}; @@ -317,6 +320,8 @@ export class HaDataTable extends LitElement { ); protected render() { + const localize = this.localizeFunc || this.hass.localize; + const columns = this._sortedColumns(this.columns, this.columnOrder); const renderRow = (row: DataTableRowData, index: number) => @@ -436,7 +441,7 @@ export class HaDataTable extends LitElement {