mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Localize hide/show password (#18607)
This commit is contained in:
parent
1d45cb78fe
commit
708ab2ed69
@ -19,11 +19,14 @@ import type {
|
|||||||
HaFormStringData,
|
HaFormStringData,
|
||||||
HaFormStringSchema,
|
HaFormStringSchema,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
const MASKED_FIELDS = ["password", "secret", "token"];
|
const MASKED_FIELDS = ["password", "secret", "token"];
|
||||||
|
|
||||||
@customElement("ha-form-string")
|
@customElement("ha-form-string")
|
||||||
export class HaFormString extends LitElement implements HaFormElement {
|
export class HaFormString extends LitElement implements HaFormElement {
|
||||||
|
@property() public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property() public schema!: HaFormStringSchema;
|
@property() public schema!: HaFormStringSchema;
|
||||||
|
|
||||||
@property() public data!: HaFormStringData;
|
@property() public data!: HaFormStringData;
|
||||||
@ -78,7 +81,11 @@ export class HaFormString extends LitElement implements HaFormElement {
|
|||||||
return html`
|
return html`
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
toggles
|
toggles
|
||||||
.label=${`${this.unmaskedPassword ? "Hide" : "Show"} password`}
|
.label=${this.hass.localize(
|
||||||
|
this.unmaskedPassword
|
||||||
|
? "ui.components.selectors.text.hide_password"
|
||||||
|
: "ui.components.selectors.text.show_password"
|
||||||
|
)}
|
||||||
@click=${this.toggleUnmaskedPassword}
|
@click=${this.toggleUnmaskedPassword}
|
||||||
.path=${this.unmaskedPassword ? mdiEyeOff : mdiEye}
|
.path=${this.unmaskedPassword ? mdiEyeOff : mdiEye}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
|
@ -76,7 +76,11 @@ export class HaTextSelector extends LitElement {
|
|||||||
${this.selector.text?.type === "password"
|
${this.selector.text?.type === "password"
|
||||||
? html`<ha-icon-button
|
? html`<ha-icon-button
|
||||||
toggles
|
toggles
|
||||||
.label=${`${this._unmaskedPassword ? "Hide" : "Show"} password`}
|
.label=${this.hass.localize(
|
||||||
|
this._unmaskedPassword
|
||||||
|
? "ui.components.selectors.text.hide_password"
|
||||||
|
: "ui.components.selectors.text.show_password"
|
||||||
|
)}
|
||||||
@click=${this._toggleUnmaskedPassword}
|
@click=${this._toggleUnmaskedPassword}
|
||||||
.path=${this._unmaskedPassword ? mdiEyeOff : mdiEye}
|
.path=${this._unmaskedPassword ? mdiEyeOff : mdiEye}
|
||||||
></ha-icon-button>`
|
></ha-icon-button>`
|
||||||
|
@ -328,6 +328,10 @@
|
|||||||
"file": {
|
"file": {
|
||||||
"upload_failed": "Upload failed",
|
"upload_failed": "Upload failed",
|
||||||
"unknown_file": "Unknown file"
|
"unknown_file": "Unknown file"
|
||||||
|
},
|
||||||
|
"text": {
|
||||||
|
"show_password": "Show password",
|
||||||
|
"hide_password": "Hide password"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"logbook": {
|
"logbook": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user