mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix blank_before_percent (#19397)
* Fix blank_before_percent * types n stuff
This commit is contained in:
parent
7c389a6cf0
commit
5aa5ce8b5e
@ -113,7 +113,7 @@ export const computeStateDisplayFromEntityAttributes = (
|
|||||||
const unit = attributes.unit_of_measurement;
|
const unit = attributes.unit_of_measurement;
|
||||||
|
|
||||||
if (unit) {
|
if (unit) {
|
||||||
return `${value}${blankBeforeUnit(unit)}${unit}`;
|
return `${value}${blankBeforeUnit(unit, locale)}${unit}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
@ -4,7 +4,7 @@ import { FrontendLocaleData } from "../../data/translation";
|
|||||||
export const blankBeforePercent = (
|
export const blankBeforePercent = (
|
||||||
localeOptions: FrontendLocaleData
|
localeOptions: FrontendLocaleData
|
||||||
): string => {
|
): string => {
|
||||||
switch (localeOptions?.language) {
|
switch (localeOptions.language) {
|
||||||
case "cz":
|
case "cz":
|
||||||
case "de":
|
case "de":
|
||||||
case "fi":
|
case "fi":
|
||||||
|
@ -3,7 +3,7 @@ import { blankBeforePercent } from "./blank_before_percent";
|
|||||||
|
|
||||||
export const blankBeforeUnit = (
|
export const blankBeforeUnit = (
|
||||||
unit: string,
|
unit: string,
|
||||||
localeOptions?: FrontendLocaleData
|
localeOptions: FrontendLocaleData | undefined
|
||||||
): string => {
|
): string => {
|
||||||
if (unit === "°") {
|
if (unit === "°") {
|
||||||
return "";
|
return "";
|
||||||
|
@ -32,7 +32,9 @@ export class HaBigNumber extends LitElement {
|
|||||||
const temperatureDecimal = formatted.replace(integer, "");
|
const temperatureDecimal = formatted.replace(integer, "");
|
||||||
|
|
||||||
const formattedValue = `${this.value}${
|
const formattedValue = `${this.value}${
|
||||||
this.unit ? `${blankBeforeUnit(this.unit)}${this.unit}` : ""
|
this.unit
|
||||||
|
? `${blankBeforeUnit(this.unit, this.hass?.locale)}${this.unit}`
|
||||||
|
: ""
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
const unitBottom = this.unitPosition === "bottom";
|
const unitBottom = this.unitPosition === "bottom";
|
||||||
|
@ -136,7 +136,9 @@ export class HaControlNumberButton extends LitElement {
|
|||||||
this.value != null
|
this.value != null
|
||||||
? formatNumber(this.value, this.locale, this.formatOptions)
|
? formatNumber(this.value, this.locale, this.formatOptions)
|
||||||
: "";
|
: "";
|
||||||
const unit = this.unit ? `${blankBeforeUnit(this.unit)}${this.unit}` : "";
|
const unit = this.unit
|
||||||
|
? `${blankBeforeUnit(this.unit, this.locale)}${this.unit}`
|
||||||
|
: "";
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -261,7 +261,7 @@ export class HaStateControlClimateTemperature extends LitElement {
|
|||||||
this.hass.locale,
|
this.hass.locale,
|
||||||
formatOptions
|
formatOptions
|
||||||
);
|
);
|
||||||
return html`${formatted}${blankBeforeUnit(unit)}${unit}`;
|
return html`${formatted}${blankBeforeUnit(unit, this.hass.locale)}${unit}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _renderCurrent(temperature: number, style: "normal" | "big") {
|
private _renderCurrent(temperature: number, style: "normal" | "big") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user