Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gulp/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ gulp.task(
'copy-binary-style-css',
'copy-binary-style-img',
'copy-js',
'pull-blockly-translations',
done => {
genHtml(true);
done();
Expand All @@ -77,6 +78,7 @@ gulp.task(
'copy-jquery-img',
'copy-binary-style-css',
'copy-binary-style-img',
'copy-js'
'copy-js',
'pull-blockly-translations'
)
);
19 changes: 17 additions & 2 deletions gulp/i18n.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const gulp = require('gulp');
const del = require('del');
const fs = require('fs');
const gulp = require('gulp');
const hash = require('sha1');
const del = require('del');
const paths = require('vinyl-paths');
const remoteSrc = require('gulp-remote-src');
const rename = require('gulp-rename');
const scanner = require('i18next-scanner');
require('./static');

Expand Down Expand Up @@ -77,3 +79,16 @@ gulp.task(
.pipe(gulp.dest('./'))
)
);

gulp.task(
'pull-blockly-translations',
gulp.series(done => {
const blocklyLanguages = ['en', 'de', 'id', 'it', 'vi', 'pl', 'ru', 'pt', 'es', 'fr', 'zh-hans', 'zh-hant'];
remoteSrc(blocklyLanguages.map(lang => `${lang}.js?_=${Date.now()}`), {
base: 'https://blockly-demo.appspot.com/static/msg/js/',
})
.pipe(rename(path => (path.extname = '.js')))
.pipe(gulp.dest('www/translations'));
done();
})
);
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"gulp-connect": "^5.0.0",
"gulp-mustache": "^4.1.0",
"gulp-open": "^3.0.1",
"gulp-remote-src": "^0.4.4",
"gulp-rename": "^1.2.2",
"gulp-rev": "^8.1.1",
"gulp-sass": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/botPage/view/blockly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const addBlocklyTranslation = () => {
lang = 'zh-hant';
}
return new Promise(resolve => {
$.getScript(`https://blockly-demo.appspot.com/static/msg/js/${lang}.js`, resolve);
$.getScript(`translations/${lang}.js`, resolve);
});
};
const onresize = () => {
Expand Down