-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added translation to badge on alarm panel #5823
Conversation
return stateLabel === "disarmed" || | ||
stateLabel === "triggered" || | ||
!stateLabel | ||
? "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You now also changed the logic of not showing the state on the badge when it is disarmed
or triggered
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my second screenshot down you can see the badge in the disarmed state so I'm not sure this logic was being used any more?
I reinstated using your suggestion below swapping : stateLabel;
to this._stateDisplay(state)
and tested and this stopped text rendering again until it was borked to disrmed at which point it skipped it and rendered the translation correctly using the amended this._stateDisplay(state)
I slimmed down to this:
private _stateIconLabel(state: string): string {return this._stateDisplay(state);
}
And it worked for both of these states:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the original code, there is no text in the badge when the state is disarmed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, d'oh. I got so wrapped up in the translations, I missed that!
stateLabel === "triggered" || | ||
!stateLabel | ||
? "" | ||
: stateLabel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could replace this with:
this._stateDisplay(state)
Hi!, thanks for fixing it! |
It will be in Home Assistant Core 0.110 |
Proposed change
Fixed issue #5786 by using a tranlated state for the badge label. Have removed legacy code that seemed to handle these names in a way that is now handled in the translations.
Screenshots below of the new translations showing:
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: