Skip to content

Commit

Permalink
use hacs localizeFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Jul 5, 2024
1 parent 5b744db commit d821808
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ set -e
cd "$(dirname "$0")/.."

node ./script/merge_requirements.js
node ./script/inject_translations.js
yarn install
23 changes: 23 additions & 0 deletions script/inject_translations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import fs from "fs";

let rawcore = fs.readFileSync("./homeassistant-frontend/src/translations/en.json");
let rawhacs = fs.readFileSync("./src/localize/languages/en.json");

const core = JSON.parse(rawcore);
const hacs = JSON.parse(rawhacs);

fs.writeFileSync(
"./src/localize/languages/en.json",
JSON.stringify(
{
...hacs,
ui: {
components: {
["subpage-data-table"]: core.ui.components["subpage-data-table"],
},
},
},
null,
2,
),
);
2 changes: 1 addition & 1 deletion src/dashboards/hacs-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class HacsDashboard extends LitElement {
.data=${repositories}
.hass=${this.hass}
?iswide=${this.isWide}
.localizeFunc=${this.hass.localize}
.localizeFunc=${this.hacs.localize}
main-page
.narrow=${this.narrow}
.route=${this.route}
Expand Down
23 changes: 23 additions & 0 deletions src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,28 @@
"message": "The {name} integration is configured or ignored. You need to delete the configuration for it before removing it from HACS.",
"confirm": "Go to integrations"
}
},
"ui": {
"components": {
"subpage-data-table": {
"filters": "Filters",
"show_results": "show {number} results",
"clear_filter": "Clear filter",
"close_filter": "Close filters",
"exit_selection_mode": "Exit selection mode",
"enter_selection_mode": "Enter selection mode",
"sort_by": "Sort by {sortColumn}",
"group_by": "Group by {groupColumn}",
"dont_group_by": "Don't group",
"collapse_all_groups": "Collapse all",
"expand_all_groups": "Expand all",
"select": "Select",
"selected": "Selected {selected}",
"close_select_mode": "Close selection mode",
"select_all": "Select all",
"select_none": "Select none",
"settings": "Customize table"
}
}
}
}

0 comments on commit d821808

Please sign in to comment.