mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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;
|
||||
|
||||
if (unit) {
|
||||
return `${value}${blankBeforeUnit(unit)}${unit}`;
|
||||
return `${value}${blankBeforeUnit(unit, locale)}${unit}`;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -4,7 +4,7 @@ import { FrontendLocaleData } from "../../data/translation";
|
||||
export const blankBeforePercent = (
|
||||
localeOptions: FrontendLocaleData
|
||||
): string => {
|
||||
switch (localeOptions?.language) {
|
||||
switch (localeOptions.language) {
|
||||
case "cz":
|
||||
case "de":
|
||||
case "fi":
|
||||
|
@ -3,7 +3,7 @@ import { blankBeforePercent } from "./blank_before_percent";
|
||||
|
||||
export const blankBeforeUnit = (
|
||||
unit: string,
|
||||
localeOptions?: FrontendLocaleData
|
||||
localeOptions: FrontendLocaleData | undefined
|
||||
): string => {
|
||||
if (unit === "°") {
|
||||
return "";
|
||||
|
@ -32,7 +32,9 @@ export class HaBigNumber extends LitElement {
|
||||
const temperatureDecimal = formatted.replace(integer, "");
|
||||
|
||||
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";
|
||||
|
@ -136,7 +136,9 @@ export class HaControlNumberButton extends LitElement {
|
||||
this.value != null
|
||||
? 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`
|
||||
<div class="container">
|
||||
|
@ -261,7 +261,7 @@ export class HaStateControlClimateTemperature extends LitElement {
|
||||
this.hass.locale,
|
||||
formatOptions
|
||||
);
|
||||
return html`${formatted}${blankBeforeUnit(unit)}${unit}`;
|
||||
return html`${formatted}${blankBeforeUnit(unit, this.hass.locale)}${unit}`;
|
||||
}
|
||||
|
||||
private _renderCurrent(temperature: number, style: "normal" | "big") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user