- No results found in "${repo.name}." + ${this.supervisor.localize( + "store.no_results_found", + "repository", + repo.name + )}
diff --git a/build-scripts/gulp/gather-static.js b/build-scripts/gulp/gather-static.js index ea5a29326f..452b4bf7c1 100644 --- a/build-scripts/gulp/gather-static.js +++ b/build-scripts/gulp/gather-static.js @@ -85,6 +85,11 @@ gulp.task("copy-translations-app", async () => { copyTranslations(staticDir); }); +gulp.task("copy-translations-supervisor", async () => { + const staticDir = paths.hassio_output_static; + copyTranslations(staticDir); +}); + gulp.task("copy-static-app", async () => { const staticDir = paths.app_output_static; // Basic static files diff --git a/build-scripts/gulp/hassio.js b/build-scripts/gulp/hassio.js index c055ba7685..49c5ecd6b6 100644 --- a/build-scripts/gulp/hassio.js +++ b/build-scripts/gulp/hassio.js @@ -10,6 +10,8 @@ require("./gen-icons-json.js"); require("./webpack.js"); require("./compress.js"); require("./rollup.js"); +require("./gather-static.js"); +require("./translations.js"); gulp.task( "develop-hassio", @@ -20,6 +22,8 @@ gulp.task( "clean-hassio", "gen-icons-json", "gen-index-hassio-dev", + "build-supervisor-translations", + "copy-translations-supervisor", env.useRollup() ? "rollup-watch-hassio" : "webpack-watch-hassio" ) ); @@ -32,6 +36,8 @@ gulp.task( }, "clean-hassio", "gen-icons-json", + "build-supervisor-translations", + "copy-translations-supervisor", env.useRollup() ? "rollup-prod-hassio" : "webpack-prod-hassio", "gen-index-hassio-prod", ...// Don't compress running tests diff --git a/build-scripts/gulp/translations.js b/build-scripts/gulp/translations.js index 609be106e7..e948a674db 100755 --- a/build-scripts/gulp/translations.js +++ b/build-scripts/gulp/translations.js @@ -266,6 +266,7 @@ gulp.task(taskName, function () { TRANSLATION_FRAGMENTS.forEach((fragment) => { delete data.ui.panel[fragment]; }); + delete data.supervisor; return data; }) ) @@ -342,6 +343,62 @@ gulp.task( } ); +gulp.task("build-translation-fragment-supervisor", function () { + return gulp + .src(fullDir + "/*.json") + .pipe(transform((data) => data.supervisor)) + .pipe(gulp.dest(workDir + "/supervisor")); +}); + +gulp.task("build-translation-flatten-supervisor", function () { + return gulp + .src(workDir + "/supervisor/*.json") + .pipe( + transform(function (data) { + // Polymer.AppLocalizeBehavior requires flattened json + return flatten(data); + }) + ) + .pipe(gulp.dest(outDir)); +}); + +gulp.task("build-translation-write-metadata", function writeMetadata() { + return gulp + .src( + [ + path.join(paths.translations_src, "translationMetadata.json"), + workDir + "/testMetadata.json", + workDir + "/translationFingerprints.json", + ], + { allowEmpty: true } + ) + .pipe(merge({})) + .pipe( + transform(function (data) { + const newData = {}; + Object.entries(data).forEach(([key, value]) => { + // Filter out translations without native name. + if (value.nativeName) { + newData[key] = value; + } else { + console.warn( + `Skipping language ${key}. Native name was not translated.` + ); + } + }); + return newData; + }) + ) + .pipe( + transform((data) => ({ + fragments: TRANSLATION_FRAGMENTS, + translations: data, + })) + ) + .pipe(rename("translationMetadata.json")) + .pipe(gulp.dest(workDir)); +}); + gulp.task( "build-translations", gulp.series( @@ -353,41 +410,20 @@ gulp.task( gulp.parallel(...splitTasks), "build-flattened-translations", "build-translation-fingerprints", - function writeMetadata() { - return gulp - .src( - [ - path.join(paths.translations_src, "translationMetadata.json"), - workDir + "/testMetadata.json", - workDir + "/translationFingerprints.json", - ], - { allowEmpty: true } - ) - .pipe(merge({})) - .pipe( - transform(function (data) { - const newData = {}; - Object.entries(data).forEach(([key, value]) => { - // Filter out translations without native name. - if (value.nativeName) { - newData[key] = value; - } else { - console.warn( - `Skipping language ${key}. Native name was not translated.` - ); - } - }); - return newData; - }) - ) - .pipe( - transform((data) => ({ - fragments: TRANSLATION_FRAGMENTS, - translations: data, - })) - ) - .pipe(rename("translationMetadata.json")) - .pipe(gulp.dest(workDir)); - } + "build-translation-write-metadata" + ) +); + +gulp.task( + "build-supervisor-translations", + gulp.series( + "clean-translations", + "ensure-translations-build-dir", + "build-master-translation", + "build-merged-translations", + "build-translation-fragment-supervisor", + "build-translation-flatten-supervisor", + "build-translation-fingerprints", + "build-translation-write-metadata" ) ); diff --git a/build-scripts/gulp/webpack.js b/build-scripts/gulp/webpack.js index c5790f0b69..2db685721f 100644 --- a/build-scripts/gulp/webpack.js +++ b/build-scripts/gulp/webpack.js @@ -137,7 +137,12 @@ gulp.task("webpack-watch-hassio", () => { isProdBuild: false, latestBuild: true, }) - ).watch({}, doneHandler()); + ).watch({ ignored: /build-translations/ }, doneHandler()); + + gulp.watch( + path.join(paths.translations_src, "en.json"), + gulp.series("build-supervisor-translations", "copy-translations-supervisor") + ); }); gulp.task("webpack-prod-hassio", () => diff --git a/build-scripts/paths.js b/build-scripts/paths.js index ae613b9b10..da9d8db190 100644 --- a/build-scripts/paths.js +++ b/build-scripts/paths.js @@ -34,6 +34,7 @@ module.exports = { hassio_dir: path.resolve(__dirname, "../hassio"), hassio_output_root: path.resolve(__dirname, "../hassio/build"), + hassio_output_static: path.resolve(__dirname, "../hassio/build/static"), hassio_output_latest: path.resolve( __dirname, "../hassio/build/frontend_latest" diff --git a/hassio/src/addon-store/hassio-addon-repository.ts b/hassio/src/addon-store/hassio-addon-repository.ts index 67c4c50849..746ee5cd8d 100644 --- a/hassio/src/addon-store/hassio-addon-repository.ts +++ b/hassio/src/addon-store/hassio-addon-repository.ts @@ -15,6 +15,7 @@ import { HassioAddonInfo, HassioAddonRepository, } from "../../../src/data/hassio/addon"; +import { Supervisor } from "../../../src/data/supervisor/supervisor"; import { HomeAssistant } from "../../../src/types"; import "../components/hassio-card-content"; import { filterAndSort } from "../components/hassio-filter-addons"; @@ -23,6 +24,8 @@ import { hassioStyle } from "../resources/hassio-style"; class HassioAddonRepositoryEl extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + @property({ attribute: false }) public supervisor!: Supervisor; + @property({ attribute: false }) public repo!: HassioAddonRepository; @property({ attribute: false }) public addons!: HassioAddonInfo[]; @@ -54,7 +57,11 @@ class HassioAddonRepositoryEl extends LitElement { return html`
- No results found in "${repo.name}." + ${this.supervisor.localize( + "store.no_results_found", + "repository", + repo.name + )}
Container | -Host | -Description | ++ ${this.supervisor.localize( + "addon.configuration.network.container" + )} + | ++ ${this.supervisor.localize( + "addon.configuration.network.host" + )} + | ++ ${this.supervisor.localize("common.description")} + |
|
- ${item.description} | +${this._computeDescription(item)} | `; })} @@ -88,10 +107,10 @@ class HassioAddonNetwork extends LitElement {
---|