Skip to content

Commit b541f97

Browse files
Copilotballoob
andauthored
Address PR review comments: localize error messages, fix deprecated method, use spacing tokens (#28246)
* Initial plan * Address PR review comments: localize error messages, replace substr with substring, use spacing tokens Co-authored-by: balloob <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: balloob <[email protected]>
1 parent 49cf84f commit b541f97

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

src/panels/config/apps/app-view/config/supervisor-app-audio.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ class SupervisorAppAudio extends LitElement {
171171
this._inputDevices = [noDevice, ...input];
172172
this._outputDevices = [noDevice, ...output];
173173
} catch {
174-
this._error = "Failed to fetch audio hardware";
174+
this._error = this.hass.localize(
175+
"ui.panel.config.apps.configuration.audio.failed_to_load_hardware"
176+
);
175177
this._inputDevices = [noDevice];
176178
this._outputDevices = [noDevice];
177179
}
@@ -198,7 +200,9 @@ class SupervisorAppAudio extends LitElement {
198200
await suggestSupervisorAppRestart(this, this.hass, this.addon);
199201
}
200202
} catch {
201-
this._error = "Failed to set addon audio device";
203+
this._error = this.hass.localize(
204+
"ui.panel.config.apps.configuration.audio.failed_to_save"
205+
);
202206
}
203207

204208
button.progress = false;

src/panels/config/apps/app-view/info/supervisor-app-info.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,9 @@ class SupervisorAppInfo extends LitElement {
11711171
button.actionError();
11721172
button.progress = false;
11731173
showAlertDialog(this, {
1174-
title: "Failed to validate addon configuration",
1174+
title: this.hass.localize(
1175+
"ui.panel.config.apps.dashboard.action_error.validate_config"
1176+
),
11751177
text: extractApiErrorMessage(err),
11761178
});
11771179
return;

src/panels/config/apps/app-view/util/supervisor-app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const extractChangelog = (
1212
content: string
1313
): string => {
1414
if (content.startsWith("# Changelog")) {
15-
content = content.substr(12, content.length);
15+
content = content.substring(12);
1616
}
1717
if (
1818
content.includes(`# ${addon.version}`) &&

src/panels/config/apps/resources/supervisor-apps-style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { css } from "lit";
22

33
export const supervisorAppsStyle = css`
44
.content {
5-
margin: 8px;
5+
margin: var(--ha-space-2);
66
}
77
h1,
88
.description,

src/translations/en.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,8 @@
25912591
"uninstall": "Failed to uninstall app",
25922592
"get_changelog": "Failed to get changelog",
25932593
"start_invalid_config": "Invalid configuration",
2594-
"go_to_config": "Go to configuration"
2594+
"go_to_config": "Go to configuration",
2595+
"validate_config": "Failed to validate app configuration"
25952596
},
25962597
"uninstall_dialog": {
25972598
"title": "Uninstall {name}?",
@@ -2634,7 +2635,9 @@
26342635
"header": "Audio",
26352636
"input": "Audio input",
26362637
"output": "Audio output",
2637-
"default": "Default"
2638+
"default": "Default",
2639+
"failed_to_load_hardware": "Failed to fetch audio hardware",
2640+
"failed_to_save": "Failed to set audio device"
26382641
},
26392642
"confirm": {
26402643
"reset_options": {

0 commit comments

Comments
 (0)