Pull in web strings into Language Pack (#158053)

remove old tasks and include web strings in export
This commit is contained in:
Tyler James Leonhardt 2022-08-15 10:46:34 -07:00 committed by GitHub
parent 5864b1f51a
commit 108916901d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 39 deletions

View file

@ -6,6 +6,7 @@
'use strict';
const gulp = require('gulp');
const merge = require('gulp-merge-json');
const fs = require('fs');
const os = require('os');
const cp = require('child_process');
@ -393,6 +394,8 @@ BUILD_TARGETS.forEach(buildTarget => {
}
});
// #region nls
const innoSetupConfig = {
'zh-cn': { codePage: 'CP936', defaultInfo: { name: 'Simplified Chinese', id: '$0804', } },
'zh-tw': { codePage: 'CP950', defaultInfo: { name: 'Traditional Chinese', id: '$0404' } },
@ -408,46 +411,23 @@ const innoSetupConfig = {
'tr': { codePage: 'CP1254' }
};
// Transifex Localizations
const apiHostname = process.env.TRANSIFEX_API_URL;
const apiName = process.env.TRANSIFEX_API_NAME;
const apiToken = process.env.TRANSIFEX_API_TOKEN;
gulp.task(task.define(
'vscode-translations-push',
task.series(
compileBuildTask,
compileExtensionsBuildTask,
optimizeVSCodeTask,
function () {
const pathToMetadata = './out-vscode/nls.metadata.json';
const pathToExtensions = '.build/extensions/*';
const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';
return es.merge(
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken)
).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken));
}
)
));
gulp.task(task.define(
'vscode-translations-export',
task.series(
compileBuildTask,
core,
compileExtensionsBuildTask,
optimizeVSCodeTask,
function () {
const pathToMetadata = './out-vscode/nls.metadata.json';
const pathToRehWebMetadata = './out-vscode-reh-web/nls.metadata.json';
const pathToExtensions = '.build/extensions/*';
const pathToSetup = 'build/win32/i18n/messages.en.isl';
return es.merge(
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
gulp.src([pathToRehWebMetadata]).pipe(merge({
fileName: 'nls.metadata.json',
jsonSpace: '',
concatArrays: true
})).pipe(i18n.createXlfFilesForCoreBundle()),
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
).pipe(vfs.dest('../vscode-translations-export'));
@ -455,13 +435,6 @@ gulp.task(task.define(
)
));
gulp.task('vscode-translations-pull', function () {
return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => {
const includeDefault = !!innoSetupConfig[language.id].defaultInfo;
return i18n.pullSetupXlfFiles(apiHostname, apiName, apiToken, language, includeDefault).pipe(vfs.dest(`../vscode-translations-import/${language.id}/setup`));
}));
});
gulp.task('vscode-translations-import', function () {
const options = minimist(process.argv.slice(2), {
string: 'location',
@ -476,3 +449,5 @@ gulp.task('vscode-translations-import', function () {
.pipe(vfs.dest(`./build/win32/i18n`));
}));
});
// #endregion

View file

@ -491,7 +491,7 @@ function processNlsFiles(opts) {
});
}
exports.processNlsFiles = processNlsFiles;
const editorProject = 'vscode-editor', workbenchProject = 'vscode-workbench', extensionsProject = 'vscode-extensions', setupProject = 'vscode-setup';
const editorProject = 'vscode-editor', workbenchProject = 'vscode-workbench', extensionsProject = 'vscode-extensions', setupProject = 'vscode-setup', serverProject = 'vscode-server';
function getResource(sourceFile) {
let resource;
if (/^vs\/platform/.test(sourceFile)) {
@ -509,6 +509,9 @@ function getResource(sourceFile) {
else if (/^vs\/code/.test(sourceFile)) {
return { name: 'vs/code', project: workbenchProject };
}
else if (/^vs\/server/.test(sourceFile)) {
return { name: 'vs/server', project: serverProject };
}
else if (/^vs\/workbench\/contrib/.test(sourceFile)) {
resource = sourceFile.split('/', 4).join('/');
return { name: resource, project: workbenchProject };

View file

@ -611,7 +611,8 @@ export function processNlsFiles(opts: { fileHeader: string; languages: Language[
const editorProject: string = 'vscode-editor',
workbenchProject: string = 'vscode-workbench',
extensionsProject: string = 'vscode-extensions',
setupProject: string = 'vscode-setup';
setupProject: string = 'vscode-setup',
serverProject: string = 'vscode-server';
export function getResource(sourceFile: string): Resource {
let resource: string;
@ -626,6 +627,8 @@ export function getResource(sourceFile: string): Resource {
return { name: 'vs/base', project: editorProject };
} else if (/^vs\/code/.test(sourceFile)) {
return { name: 'vs/code', project: workbenchProject };
} else if (/^vs\/server/.test(sourceFile)) {
return { name: 'vs/server', project: serverProject };
} else if (/^vs\/workbench\/contrib/.test(sourceFile)) {
resource = sourceFile.split('/', 4).join('/');
return { name: resource, project: workbenchProject };