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