Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use localize func in table settings dialog #21335

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/data-table/dialog-data-table-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export class DialogDataTableSettings extends LitElement {
return nothing;
}

const localize = this._params.localizeFunc || this.hass.localize;

const columns = this._sortedColumns(
this._params.columns,
this._columnOrder,
Expand All @@ -90,7 +92,7 @@ export class DialogDataTableSettings extends LitElement {
@closed=${this.closeDialog}
.heading=${createCloseHeading(
this.hass,
this.hass.localize("ui.components.data-table.settings.header")
localize("ui.components.data-table.settings.header")
)}
>
<ha-sortable
Expand Down Expand Up @@ -146,12 +148,10 @@ export class DialogDataTableSettings extends LitElement {
</mwc-list>
</ha-sortable>
<ha-button slot="secondaryAction" @click=${this._reset}
>${this.hass.localize(
"ui.components.data-table.settings.restore"
)}</ha-button
>${localize("ui.components.data-table.settings.restore")}</ha-button
>
<ha-button slot="primaryAction" @click=${this.closeDialog}>
${this.hass.localize("ui.components.data-table.settings.done")}
${localize("ui.components.data-table.settings.done")}
</ha-button>
</ha-dialog>
`;
Expand Down
2 changes: 2 additions & 0 deletions src/components/data-table/show-dialog-data-table-settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fireEvent } from "../../common/dom/fire_event";
import { LocalizeFunc } from "../../common/translations/localize";
frenck marked this conversation as resolved.
Show resolved Hide resolved
import { DataTableColumnContainer } from "./ha-data-table";

export interface DataTableSettingsDialogParams {
Expand All @@ -9,6 +10,7 @@ export interface DataTableSettingsDialogParams {
) => void;
hiddenColumns?: string[];
columnOrder?: string[];
localizeFunc?: LocalizeFunc;
}

export const loadDataTableSettingsDialog = () =>
Expand Down
1 change: 1 addition & 0 deletions src/layouts/hass-tabs-subpage-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ export class HaTabsSubpageDataTable extends LitElement {
this.hiddenColumns = hiddenColumns;
fireEvent(this, "columns-changed", { columnOrder, hiddenColumns });
},
localizeFunc: this.localizeFunc,
frenck marked this conversation as resolved.
Show resolved Hide resolved
});
}

Expand Down
Loading