mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Use en "–" and em "—" dashes consistently (#11401)
This commit is contained in:
parent
22b4550fdf
commit
72bd5f84d6
@ -43,7 +43,7 @@ export const computeStateDisplay = (
|
|||||||
|
|
||||||
if (domain === "input_datetime") {
|
if (domain === "input_datetime") {
|
||||||
if (state !== undefined) {
|
if (state !== undefined) {
|
||||||
// If trying to display an explicit state, need to parse the explict state to `Date` then format.
|
// If trying to display an explicit state, need to parse the explicit state to `Date` then format.
|
||||||
// Attributes aren't available, we have to use `state`.
|
// Attributes aren't available, we have to use `state`.
|
||||||
try {
|
try {
|
||||||
const components = state.split(" ");
|
const components = state.split(" ");
|
||||||
|
@ -147,7 +147,7 @@ export class HaStateLabelBadge extends LitElement {
|
|||||||
default:
|
default:
|
||||||
return entityState.state === UNKNOWN ||
|
return entityState.state === UNKNOWN ||
|
||||||
entityState.state === UNAVAILABLE
|
entityState.state === UNAVAILABLE
|
||||||
? "-"
|
? "—"
|
||||||
: isNumericState(entityState)
|
: isNumericState(entityState)
|
||||||
? formatNumber(entityState.state, this.hass!.locale)
|
? formatNumber(entityState.state, this.hass!.locale)
|
||||||
: computeStateDisplay(
|
: computeStateDisplay(
|
||||||
|
@ -120,7 +120,7 @@ class HaAttributes extends LitElement {
|
|||||||
|
|
||||||
private formatAttribute(attribute: string): string | TemplateResult {
|
private formatAttribute(attribute: string): string | TemplateResult {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return "-";
|
return "—";
|
||||||
}
|
}
|
||||||
const value = this.stateObj.attributes[attribute];
|
const value = this.stateObj.attributes[attribute];
|
||||||
return formatAttributeValue(this.hass, value);
|
return formatAttributeValue(this.hass, value);
|
||||||
|
@ -64,7 +64,7 @@ class HaWaterHeaterState extends LocalizeMixin(PolymerElement) {
|
|||||||
return `${formatNumber(
|
return `${formatNumber(
|
||||||
stateObj.attributes.target_temp_low,
|
stateObj.attributes.target_temp_low,
|
||||||
this.hass.locale
|
this.hass.locale
|
||||||
)} - ${formatNumber(
|
)} – ${formatNumber(
|
||||||
stateObj.attributes.target_temp_high,
|
stateObj.attributes.target_temp_high,
|
||||||
this.hass.locale
|
this.hass.locale
|
||||||
)} ${hass.config.unit_system.temperature}`;
|
)} ${hass.config.unit_system.temperature}`;
|
||||||
|
@ -320,7 +320,7 @@ export class HaConfigDeviceDashboard extends LitElement {
|
|||||||
.batteryChargingStateObj=${batteryCharging}
|
.batteryChargingStateObj=${batteryCharging}
|
||||||
></ha-battery-icon>
|
></ha-battery-icon>
|
||||||
`
|
`
|
||||||
: html` - `;
|
: html`—`;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (showDisabled) {
|
if (showDisabled) {
|
||||||
|
@ -89,7 +89,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
|||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
`ui.panel.config.lovelace.dashboards.conf_mode.${dashboard.mode}`
|
`ui.panel.config.lovelace.dashboards.conf_mode.${dashboard.mode}`
|
||||||
)}${dashboard.filename
|
)}${dashboard.filename
|
||||||
? html` - ${dashboard.filename} `
|
? html` – ${dashboard.filename} `
|
||||||
: ""}
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
@ -132,8 +132,8 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
|||||||
width: "100px",
|
width: "100px",
|
||||||
template: (requireAdmin: boolean) =>
|
template: (requireAdmin: boolean) =>
|
||||||
requireAdmin
|
requireAdmin
|
||||||
? html` <ha-svg-icon .path=${mdiCheck}></ha-svg-icon> `
|
? html`<ha-svg-icon .path=${mdiCheck}></ha-svg-icon>`
|
||||||
: html` - `,
|
: html`—`,
|
||||||
};
|
};
|
||||||
columns.show_in_sidebar = {
|
columns.show_in_sidebar = {
|
||||||
title: this.hass.localize(
|
title: this.hass.localize(
|
||||||
@ -143,8 +143,8 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
|||||||
width: "121px",
|
width: "121px",
|
||||||
template: (sidebar) =>
|
template: (sidebar) =>
|
||||||
sidebar
|
sidebar
|
||||||
? html` <ha-svg-icon .path=${mdiCheck}></ha-svg-icon> `
|
? html`<ha-svg-icon .path=${mdiCheck}></ha-svg-icon>`
|
||||||
: html` - `,
|
: html`—`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export class HaConfigUsers extends LitElement {
|
|||||||
width: "20%",
|
width: "20%",
|
||||||
direction: "asc",
|
direction: "asc",
|
||||||
hidden: narrow,
|
hidden: narrow,
|
||||||
template: (username) => html` ${username || "-"} `,
|
template: (username) => html`${username || "—"}`,
|
||||||
},
|
},
|
||||||
group_ids: {
|
group_ids: {
|
||||||
title: localize("ui.panel.config.users.picker.headers.group"),
|
title: localize("ui.panel.config.users.picker.headers.group"),
|
||||||
|
@ -274,7 +274,7 @@ class HuiEnergyDistrubutionCard
|
|||||||
? formatNumber(lowCarbonEnergy, this.hass.locale, {
|
? formatNumber(lowCarbonEnergy, this.hass.locale, {
|
||||||
maximumFractionDigits: 1,
|
maximumFractionDigits: 1,
|
||||||
})
|
})
|
||||||
: "-"}
|
: "—"}
|
||||||
kWh
|
kWh
|
||||||
</a>
|
</a>
|
||||||
<svg width="80" height="30">
|
<svg width="80" height="30">
|
||||||
|
@ -191,7 +191,7 @@ export class HuiEnergyGasGraphCard
|
|||||||
return datasets[0].label;
|
return datasets[0].label;
|
||||||
}
|
}
|
||||||
const date = new Date(datasets[0].parsed.x);
|
const date = new Date(datasets[0].parsed.x);
|
||||||
return `${formatTime(date, locale)} - ${formatTime(
|
return `${formatTime(date, locale)} – ${formatTime(
|
||||||
addHours(date, 1),
|
addHours(date, 1),
|
||||||
locale
|
locale
|
||||||
)}`;
|
)}`;
|
||||||
|
@ -184,7 +184,7 @@ export class HuiEnergySolarGraphCard
|
|||||||
return datasets[0].label;
|
return datasets[0].label;
|
||||||
}
|
}
|
||||||
const date = new Date(datasets[0].parsed.x);
|
const date = new Date(datasets[0].parsed.x);
|
||||||
return `${formatTime(date, locale)} - ${formatTime(
|
return `${formatTime(date, locale)} – ${formatTime(
|
||||||
addHours(date, 1),
|
addHours(date, 1),
|
||||||
locale
|
locale
|
||||||
)}`;
|
)}`;
|
||||||
|
@ -177,7 +177,7 @@ export class HuiEnergyUsageGraphCard
|
|||||||
return datasets[0].label;
|
return datasets[0].label;
|
||||||
}
|
}
|
||||||
const date = new Date(datasets[0].parsed.x);
|
const date = new Date(datasets[0].parsed.x);
|
||||||
return `${formatTime(date, locale)} - ${formatTime(
|
return `${formatTime(date, locale)} – ${formatTime(
|
||||||
addHours(date, 1),
|
addHours(date, 1),
|
||||||
locale
|
locale
|
||||||
)}`;
|
)}`;
|
||||||
|
@ -103,7 +103,7 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) {
|
|||||||
: `${formatDateShort(
|
: `${formatDateShort(
|
||||||
this._startDate,
|
this._startDate,
|
||||||
this.hass.locale
|
this.hass.locale
|
||||||
)} - ${formatDateShort(
|
)} – ${formatDateShort(
|
||||||
this._endDate || new Date(),
|
this._endDate || new Date(),
|
||||||
this.hass.locale
|
this.hass.locale
|
||||||
)}`}
|
)}`}
|
||||||
|
@ -75,7 +75,7 @@ class HuiAttributeRow extends LitElement implements LovelaceRow {
|
|||||||
? formatNumber(attribute, this.hass.locale)
|
? formatNumber(attribute, this.hass.locale)
|
||||||
: attribute !== undefined
|
: attribute !== undefined
|
||||||
? formatAttributeValue(this.hass, attribute)
|
? formatAttributeValue(this.hass, attribute)
|
||||||
: "-"}
|
: "—"}
|
||||||
${this._config.suffix}
|
${this._config.suffix}
|
||||||
</hui-generic-entity-row>
|
</hui-generic-entity-row>
|
||||||
`;
|
`;
|
||||||
|
@ -3,7 +3,7 @@ import { Constructor, HomeAssistant } from "../types";
|
|||||||
import { HassBaseEl } from "./hass-base-mixin";
|
import { HassBaseEl } from "./hass-base-mixin";
|
||||||
|
|
||||||
const setTitle = (title: string | undefined) => {
|
const setTitle = (title: string | undefined) => {
|
||||||
document.title = title ? `${title} - Home Assistant` : "Home Assistant";
|
document.title = title ? `${title} – Home Assistant` : "Home Assistant";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const panelTitleMixin = <T extends Constructor<HassBaseEl>>(
|
export const panelTitleMixin = <T extends Constructor<HassBaseEl>>(
|
||||||
|
@ -176,7 +176,7 @@ export function formatAttributeValue(
|
|||||||
value: any
|
value: any
|
||||||
): string | TemplateResult {
|
): string | TemplateResult {
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
return "-";
|
return "—";
|
||||||
}
|
}
|
||||||
|
|
||||||
// YAML handling
|
// YAML handling
|
||||||
|
Loading…
x
Reference in New Issue
Block a user