Skip to content

Commit

Permalink
Load translations when adding item in pickers (#20325)
Browse files Browse the repository at this point in the history
* Load translations when adding item in pickers

* Update ha-selector-label.ts
  • Loading branch information
bramkragten authored Apr 2, 2024
1 parent 169d782 commit 21ed8e4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/ha-area-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ export class HaAreaPicker extends LitElement {

(ev.target as any).value = this._value;

this.hass.loadFragmentTranslation("config");

showAreaRegistryDetailDialog(this, {
suggestedName: newValue === ADD_NEW_SUGGESTION_ID ? this._suggestion : "",
createEntry: async (values) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/ha-floor-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ export class HaFloorPicker extends SubscribeMixin(LitElement) {

(ev.target as any).value = this._value;

this.hass.loadFragmentTranslation("config");

showFloorRegistryDetailDialog(this, {
suggestedName: newValue === ADD_NEW_SUGGESTION_ID ? this._suggestion : "",
createEntry: async (values) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/ha-label-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ export class HaLabelPicker extends SubscribeMixin(LitElement) {

(ev.target as any).value = this._value;

this.hass.loadFragmentTranslation("config");

showLabelDetailDialog(this, {
entry: undefined,
suggestedName: newValue === ADD_NEW_SUGGESTION_ID ? this._suggestion : "",
Expand Down
2 changes: 2 additions & 0 deletions src/components/ha-selector/ha-selector-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class HaLabelSelector extends LitElement {
if (this.selector.label.multiple) {
return html`
<ha-labels-picker
no-add
.hass=${this.hass}
.value=${ensureArray(this.value ?? [])}
.disabled=${this.disabled}
Expand All @@ -41,6 +42,7 @@ export class HaLabelSelector extends LitElement {
}
return html`
<ha-label-picker
no-add
.hass=${this.hass}
.value=${this.value}
.disabled=${this.disabled}
Expand Down
2 changes: 2 additions & 0 deletions src/panels/config/category/ha-category-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ export class HaCategoryPicker extends SubscribeMixin(LitElement) {

(ev.target as any).value = this._value;

this.hass.loadFragmentTranslation("config");

showCategoryRegistryDetailDialog(this, {
scope: this.scope!,
suggestedName: newValue === ADD_NEW_SUGGESTION_ID ? this._suggestion : "",
Expand Down

0 comments on commit 21ed8e4

Please sign in to comment.