mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 12:26:35 +00:00
Recreate translations when changed on dev (#5042)
This commit is contained in:
parent
5066560411
commit
d392695ab7
@ -65,6 +65,12 @@ function copyMapPanel(staticDir) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gulp.task("copy-translations", (done) => {
|
||||||
|
const staticDir = paths.static;
|
||||||
|
copyTranslations(staticDir);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task("copy-static", (done) => {
|
gulp.task("copy-static", (done) => {
|
||||||
const staticDir = paths.static;
|
const staticDir = paths.static;
|
||||||
const staticPath = genStaticPath(paths.static);
|
const staticPath = genStaticPath(paths.static);
|
||||||
|
@ -12,6 +12,7 @@ const rename = require("gulp-rename");
|
|||||||
const transform = require("gulp-json-transform");
|
const transform = require("gulp-json-transform");
|
||||||
const { mapFiles } = require("../util");
|
const { mapFiles } = require("../util");
|
||||||
const env = require("../env");
|
const env = require("../env");
|
||||||
|
const paths = require("../paths");
|
||||||
|
|
||||||
const inDir = "translations";
|
const inDir = "translations";
|
||||||
const workDir = "build-translations";
|
const workDir = "build-translations";
|
||||||
@ -144,7 +145,7 @@ gulp.task(
|
|||||||
"create-test-translation",
|
"create-test-translation",
|
||||||
gulp.series("create-test-metadata", function createTestTranslation() {
|
gulp.series("create-test-metadata", function createTestTranslation() {
|
||||||
return gulp
|
return gulp
|
||||||
.src("src/translations/en.json")
|
.src(path.join(paths.translations_src, "en.json"))
|
||||||
.pipe(
|
.pipe(
|
||||||
transform(function(data, file) {
|
transform(function(data, file) {
|
||||||
return recursiveEmpty(data);
|
return recursiveEmpty(data);
|
||||||
@ -166,7 +167,7 @@ gulp.task(
|
|||||||
*/
|
*/
|
||||||
gulp.task("build-master-translation", function() {
|
gulp.task("build-master-translation", function() {
|
||||||
return gulp
|
return gulp
|
||||||
.src("src/translations/en.json")
|
.src(path.join(paths.translations_src, "en.json"))
|
||||||
.pipe(
|
.pipe(
|
||||||
transform(function(data, file) {
|
transform(function(data, file) {
|
||||||
return lokaliseTransform(data, data, file);
|
return lokaliseTransform(data, data, file);
|
||||||
@ -341,7 +342,7 @@ gulp.task(
|
|||||||
return gulp
|
return gulp
|
||||||
.src(
|
.src(
|
||||||
[
|
[
|
||||||
"src/translations/translationMetadata.json",
|
path.join(paths.translations_src, "translationMetadata.json"),
|
||||||
workDir + "/testMetadata.json",
|
workDir + "/testMetadata.json",
|
||||||
workDir + "/translationFingerprints.json",
|
workDir + "/translationFingerprints.json",
|
||||||
],
|
],
|
||||||
|
@ -3,6 +3,7 @@ const gulp = require("gulp");
|
|||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const WebpackDevServer = require("webpack-dev-server");
|
const WebpackDevServer = require("webpack-dev-server");
|
||||||
const log = require("fancy-log");
|
const log = require("fancy-log");
|
||||||
|
const path = require("path");
|
||||||
const paths = require("../paths");
|
const paths = require("../paths");
|
||||||
const {
|
const {
|
||||||
createAppConfig,
|
createAppConfig,
|
||||||
@ -58,9 +59,13 @@ const handler = (done) => (err, stats) => {
|
|||||||
gulp.task("webpack-watch-app", () => {
|
gulp.task("webpack-watch-app", () => {
|
||||||
// we are not calling done, so this command will run forever
|
// we are not calling done, so this command will run forever
|
||||||
webpack(createAppConfig({ isProdBuild: false, latestBuild: true })).watch(
|
webpack(createAppConfig({ isProdBuild: false, latestBuild: true })).watch(
|
||||||
{},
|
{ ignored: /build-translations/ },
|
||||||
handler()
|
handler()
|
||||||
);
|
);
|
||||||
|
gulp.watch(
|
||||||
|
path.join(paths.translations_src, "en.json"),
|
||||||
|
gulp.series("build-translations", "copy-translations")
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
|
@ -29,4 +29,6 @@ module.exports = {
|
|||||||
hassio_dir: path.resolve(__dirname, "../hassio"),
|
hassio_dir: path.resolve(__dirname, "../hassio"),
|
||||||
hassio_root: path.resolve(__dirname, "../hassio/build"),
|
hassio_root: path.resolve(__dirname, "../hassio/build"),
|
||||||
hassio_publicPath: "/api/hassio/app/",
|
hassio_publicPath: "/api/hassio/app/",
|
||||||
|
|
||||||
|
translations_src: path.resolve(__dirname, "../src/translations"),
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user