Use en "–" and em "—" dashes consistently (#11401)

This commit is contained in:
Philip Allgaier 2022-01-24 10:02:44 +01:00 committed by GitHub
parent 22b4550fdf
commit 72bd5f84d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 19 additions and 19 deletions

View File

@ -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(" ");

View File

@ -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(

View File

@ -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);

View File

@ -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}`;

View File

@ -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) {

View File

@ -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``,
}; };
} }

View File

@ -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"),

View File

@ -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">

View File

@ -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
)}`; )}`;

View File

@ -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
)}`; )}`;

View File

@ -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
)}`; )}`;

View File

@ -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
)}`} )}`}

View File

@ -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>
`; `;

View File

@ -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>>(

View File

@ -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