Skip to content

Commit

Permalink
Update gulp script for transifex -> new platform
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jan 16, 2019
1 parent 4f76d55 commit 4d56c0a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 73 deletions.
42 changes: 21 additions & 21 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ const runSequence = require('run-sequence');
const del = require('del');
const minimist = require('minimist');

const transifexApiHostname = 'www.transifex.com'
const transifexApiName = 'api';
const transifexApiToken = process.env.TRANSIFEX_API_TOKEN;
const transifexProjectName = 'vscode-extensions';
const transifexExtensionName = 'vscode-chrome-debug';
const translationProjectName = 'vscode-extensions';
const translationExtensionName = 'vscode-chrome-debug';

const defaultLanguages = [
{ id: 'zh-tw', folderName: 'cht', transifexId: 'zh-hant' },
Expand Down Expand Up @@ -170,28 +167,31 @@ gulp.task('add-i18n', function () {
.pipe(gulp.dest('.'));
});

gulp.task('transifex-push', ['build'], function () {
return gulp.src(['package.nls.json', 'out/nls.metadata.header.json', 'out/nls.metadata.json'])
.pipe(nls.createXlfFiles(transifexProjectName, transifexExtensionName))
.pipe(nls.pushXlfFiles(transifexApiHostname, transifexApiName, transifexApiToken));
gulp.task('translations-export', ['build'], function() {
return gulp.src(['package.nls.json', 'out/nls.metadata.header.json', 'out/nls.metadata.json'])
.pipe(nls.createXlfFiles(translationProjectName, translationExtensionName))
.pipe(gulp.dest(path.join('..', 'vscode-translations-export')));
});

gulp.task('transifex-push-test', ['build'], function () {
return gulp.src(['package.nls.json', 'out/nls.metadata.header.json', 'out/nls.metadata.json'])
.pipe(nls.createXlfFiles(transifexProjectName, transifexExtensionName))
.pipe(gulp.dest(path.join('..', `${transifexExtensionName}-push-test`)));
});

gulp.task('transifex-pull', function () {
return es.merge(defaultLanguages.map(function (language) {
return nls.pullXlfFiles(transifexApiHostname, transifexApiName, transifexApiToken, language, [{ name: transifexExtensionName, project: transifexProjectName }]).
pipe(gulp.dest(`../${transifexExtensionName}-localization/${language.folderName}`));
}));
gulp.task('translations-import', function() {
var options = minimist(process.argv.slice(2), {
string: 'location',
default: {
location: '../vscode-translations-import'
}
});
return es.merge(defaultLanguages.map(function(language) {
let id = language.transifexId || language.id;
console.log(path.join(options.location, id, 'vscode-extensions', `${translationExtensionName}.xlf`));
return gulp.src(path.join(options.location, id, 'vscode-extensions', `${translationExtensionName}.xlf`))
.pipe(nls.prepareJsonFiles())
.pipe(gulp.dest(path.join('./i18n', language.folderName)));
}));
});

gulp.task('i18n-import', function () {
return es.merge(defaultLanguages.map(function (language) {
return gulp.src(`../${transifexExtensionName}-localization/${language.folderName}/**/*.xlf`)
return gulp.src(`../${translationExtensionName}-localization/${language.folderName}/**/*.xlf`)
.pipe(nls.prepareJsonFiles())
.pipe(gulp.dest(path.join('./i18n', language.folderName)));
}));
Expand Down
Loading

0 comments on commit 4d56c0a

Please sign in to comment.