mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
added import-extensions-xlf gulp task (#15966)
* added import-extensions-xlf gulp task * combined export and import * changed vscode-translations-export * added rename vscode langpacks task * added node command to import language xlfs * fixed import language xlfs command * added comments * removed import script as we need to investigate localization
This commit is contained in:
@@ -146,4 +146,8 @@ gulp.task('package-rebuild-extensions', task.series(
|
|||||||
task.define('rebuild-extensions-build', () => ext.packageRebuildExtensionsStream().pipe(gulp.dest('.build'))),
|
task.define('rebuild-extensions-build', () => ext.packageRebuildExtensionsStream().pipe(gulp.dest('.build'))),
|
||||||
));
|
));
|
||||||
|
|
||||||
gulp.task('refresh-langpacks', () => loc.refreshLangpacks());
|
gulp.task('update-langpacks', task.series(
|
||||||
|
task.define('rename-vscode-packs', () => loc.renameVscodeLangpacks()),
|
||||||
|
task.define('refresh-langpack-resources', () => loc.refreshLangpacks())
|
||||||
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -108,16 +108,48 @@ const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
|
|||||||
));
|
));
|
||||||
gulp.task(optimizeVSCodeTask);
|
gulp.task(optimizeVSCodeTask);
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}} Gulp task that exports any extensions found in the build folder as an XLF to an external folder.
|
// {{SQL CARBON EDIT}} Gulp task that imports any relevant ADS XLF found in vscode-translations-export to resources/xlf/en folder.
|
||||||
const exportXLFFolderTask = task.define('export-xlf-folder',
|
|
||||||
function () {
|
// List of ADS extension XLF files that we want to put into the English resource folder.
|
||||||
const pathToExtensions = '.build/extensions/*';
|
const extensionsFilter = filter([
|
||||||
return es.merge(
|
"**/admin-tool-ext-win.xlf",
|
||||||
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
"**/agent.xlf",
|
||||||
).pipe(vfs.dest('../export-xlfs'));
|
"**/arc.xlf",
|
||||||
}
|
"**/asde-deployment.xlf",
|
||||||
);
|
"**/azdata.xlf",
|
||||||
gulp.task(exportXLFFolderTask);
|
"**/azurecore.xlf",
|
||||||
|
"**/azurehybridtoolkit.xlf",
|
||||||
|
"**/big-data-cluster.xlf",
|
||||||
|
"**/cms.xlf",
|
||||||
|
"**/dacpac.xlf",
|
||||||
|
"**/data-workspace.xlf",
|
||||||
|
"**/import.xlf",
|
||||||
|
"**/kusto.xlf",
|
||||||
|
"**/machine-learning.xlf",
|
||||||
|
"**/Microsoft.sqlservernotebook.xlf",
|
||||||
|
"**/mssql.xlf",
|
||||||
|
"**/notebook.xlf",
|
||||||
|
"**/profiler.xlf",
|
||||||
|
"**/query-history.xlf",
|
||||||
|
"**/resource-deployment.xlf",
|
||||||
|
"**/schema-compare.xlf",
|
||||||
|
"**/server-report.xlf",
|
||||||
|
"**/sql-assessment.xlf",
|
||||||
|
"**/sql-database-projects.xlf",
|
||||||
|
"**/sql-migration.xlf",
|
||||||
|
"**/xml-language-features.xlf"
|
||||||
|
])
|
||||||
|
|
||||||
|
// Copy ADS extension XLFs into English resource folder.
|
||||||
|
const importExtensionsTask = task.define('import-extensions-xlfs', function () {
|
||||||
|
return es.merge(
|
||||||
|
gulp.src(`./vscode-translations-export/vscode-extensions/*.xlf`)
|
||||||
|
.pipe(extensionsFilter),
|
||||||
|
gulp.src(`./vscode-translations-export/ads-core/*.xlf`)
|
||||||
|
)
|
||||||
|
.pipe(vfs.dest(`./resources/xlf/en`));
|
||||||
|
});
|
||||||
|
gulp.task(importExtensionsTask)
|
||||||
// {{SQL CARBON EDIT}} end
|
// {{SQL CARBON EDIT}} end
|
||||||
|
|
||||||
const sourceMappingURLBase = `https://sqlopsbuilds.blob.core.windows.net/sourcemaps/${commit}`;
|
const sourceMappingURLBase = `https://sqlopsbuilds.blob.core.windows.net/sourcemaps/${commit}`;
|
||||||
@@ -449,11 +481,12 @@ gulp.task(task.define(
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
gulp.task(task.define(
|
// {{SQL CARBON EDIT}} Allow for gulp task to be added to update-english-xlfs.
|
||||||
|
const vscodeTranslationsExport = task.define(
|
||||||
'vscode-translations-export',
|
'vscode-translations-export',
|
||||||
task.series(
|
task.series(
|
||||||
compileBuildTask,
|
compileBuildTask,
|
||||||
compileExtensionsBuildTask,
|
compileLocalizationExtensionsBuildTask, // {{SQL CARBON EDIT}} now include all extensions in ADS, not just a subset. (replaces "compileExtensionsBuildTask" here).
|
||||||
optimizeVSCodeTask,
|
optimizeVSCodeTask,
|
||||||
function () {
|
function () {
|
||||||
const pathToMetadata = './out-vscode/nls.metadata.json';
|
const pathToMetadata = './out-vscode/nls.metadata.json';
|
||||||
@@ -464,17 +497,19 @@ gulp.task(task.define(
|
|||||||
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
|
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
|
||||||
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
|
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
|
||||||
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
||||||
).pipe(vfs.dest('../vscode-translations-export'));
|
).pipe(vfs.dest('./vscode-translations-export')); // {{SQL CARBON EDIT}} move vscode-translations-export into ADS (for safely deleting after use).
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
));
|
);
|
||||||
|
gulp.task(vscodeTranslationsExport)
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}} Localization gulp task, similar to vscode-translations-export but for all extensions.
|
// {{SQL CARBON EDIT}} Localization gulp task, runs vscodeTranslationsExport and imports a subset of the generated XLFs into the folder.
|
||||||
gulp.task(task.define(
|
gulp.task(task.define(
|
||||||
'export-xlfs',
|
'update-english-xlfs',
|
||||||
task.series(
|
task.series(
|
||||||
compileLocalizationExtensionsBuildTask,
|
vscodeTranslationsExport,
|
||||||
exportXLFFolderTask
|
importExtensionsTask,
|
||||||
|
task.define('delete-vscode-translations-export', util.rimraf('./vscode-translations-export'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
// {{SQL CARBON EDIT}} end
|
// {{SQL CARBON EDIT}} end
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ function processNlsFiles(opts) {
|
|||||||
exports.processNlsFiles = processNlsFiles;
|
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';
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const sqlopsProject = 'sqlops-core';
|
const adsProject = 'ads-core';
|
||||||
function getResource(sourceFile) {
|
function getResource(sourceFile) {
|
||||||
let resource;
|
let resource;
|
||||||
if (/^vs\/platform/.test(sourceFile)) {
|
if (/^vs\/platform/.test(sourceFile)) {
|
||||||
@@ -515,7 +515,7 @@ function getResource(sourceFile) {
|
|||||||
}
|
}
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
else if (/^sql/.test(sourceFile)) {
|
else if (/^sql/.test(sourceFile)) {
|
||||||
return { name: 'sql', project: sqlopsProject };
|
return { name: 'sql', project: adsProject };
|
||||||
}
|
}
|
||||||
throw new Error(`Could not identify the XLF bundle for ${sourceFile}`);
|
throw new Error(`Could not identify the XLF bundle for ${sourceFile}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ const editorProject: string = 'vscode-editor',
|
|||||||
setupProject: string = 'vscode-setup';
|
setupProject: string = 'vscode-setup';
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const sqlopsProject: string = 'sqlops-core';
|
const adsProject: string = 'ads-core';
|
||||||
|
|
||||||
export function getResource(sourceFile: string): Resource {
|
export function getResource(sourceFile: string): Resource {
|
||||||
let resource: string;
|
let resource: string;
|
||||||
@@ -638,7 +638,7 @@ export function getResource(sourceFile: string): Resource {
|
|||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
else if (/^sql/.test(sourceFile)) {
|
else if (/^sql/.test(sourceFile)) {
|
||||||
return { name: 'sql', project: sqlopsProject };
|
return { name: 'sql', project: adsProject };
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Could not identify the XLF bundle for ${sourceFile}`);
|
throw new Error(`Could not identify the XLF bundle for ${sourceFile}`);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.refreshLangpacks = exports.modifyI18nPackFiles = exports.packageSingleExtensionStream = exports.packageLangpacksStream = void 0;
|
exports.renameVscodeLangpacks = exports.refreshLangpacks = exports.modifyI18nPackFiles = exports.packageSingleExtensionStream = exports.packageLangpacksStream = void 0;
|
||||||
const es = require("event-stream");
|
const es = require("event-stream");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const glob = require("glob");
|
const glob = require("glob");
|
||||||
@@ -340,3 +340,37 @@ function refreshLangpacks() {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
exports.refreshLangpacks = refreshLangpacks;
|
exports.refreshLangpacks = refreshLangpacks;
|
||||||
|
/**
|
||||||
|
* Function for adding replacing ads language packs with vscode ones.
|
||||||
|
* For new languages, remember to add to i18n.extraLanguages so that it will be recognized by ADS.
|
||||||
|
*/
|
||||||
|
function renameVscodeLangpacks() {
|
||||||
|
let supportedLocations = [...i18n.defaultLanguages, ...i18n.extraLanguages];
|
||||||
|
for (let i = 0; i < supportedLocations.length; i++) {
|
||||||
|
let langId = supportedLocations[i].id;
|
||||||
|
if (langId === "zh-cn") {
|
||||||
|
langId = "zh-hans";
|
||||||
|
}
|
||||||
|
if (langId === "zh-tw") {
|
||||||
|
langId = "zh-hant";
|
||||||
|
}
|
||||||
|
let locADSFolder = path.join('.', 'i18n', `ads-language-pack-${langId}`);
|
||||||
|
let locVSCODEFolder = path.join('.', 'i18n', `vscode-language-pack-${langId}`);
|
||||||
|
try {
|
||||||
|
fs.statSync(locVSCODEFolder);
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
console.log('vscode pack is not in ADS yet: ' + langId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
gulp.src(`i18n/ads-language-pack-${langId}/*.md`)
|
||||||
|
.pipe(vfs.dest(locVSCODEFolder, { overwrite: true }))
|
||||||
|
.end(function () {
|
||||||
|
rimraf.sync(locADSFolder);
|
||||||
|
fs.renameSync(locVSCODEFolder, locADSFolder);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log("Langpack Rename Completed.");
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
exports.renameVscodeLangpacks = renameVscodeLangpacks;
|
||||||
|
|||||||
@@ -362,3 +362,40 @@ export function refreshLangpacks(): Promise<void> {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for adding replacing ads language packs with vscode ones.
|
||||||
|
* For new languages, remember to add to i18n.extraLanguages so that it will be recognized by ADS.
|
||||||
|
*/
|
||||||
|
export function renameVscodeLangpacks(): Promise<void> {
|
||||||
|
let supportedLocations = [...i18n.defaultLanguages, ...i18n.extraLanguages];
|
||||||
|
|
||||||
|
|
||||||
|
for (let i = 0; i < supportedLocations.length; i++) {
|
||||||
|
let langId = supportedLocations[i].id;
|
||||||
|
if (langId === "zh-cn") {
|
||||||
|
langId = "zh-hans";
|
||||||
|
}
|
||||||
|
if (langId === "zh-tw") {
|
||||||
|
langId = "zh-hant";
|
||||||
|
}
|
||||||
|
let locADSFolder = path.join('.', 'i18n', `ads-language-pack-${langId}`);
|
||||||
|
let locVSCODEFolder = path.join('.', 'i18n', `vscode-language-pack-${langId}`);
|
||||||
|
try {
|
||||||
|
fs.statSync(locVSCODEFolder);
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
console.log('vscode pack is not in ADS yet: ' + langId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
gulp.src(`i18n/ads-language-pack-${langId}/*.md`)
|
||||||
|
.pipe(vfs.dest(locVSCODEFolder, {overwrite: true}))
|
||||||
|
.end(function () {
|
||||||
|
rimraf.sync(locADSFolder);
|
||||||
|
fs.renameSync(locVSCODEFolder, locADSFolder);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Langpack Rename Completed.");
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ exports.rollupAngular = void 0;
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const rollup = require("rollup");
|
const rollup = require("rollup");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
// getting around stupid import rules
|
// getting around import rules
|
||||||
const nodeResolve = require('rollup-plugin-node-resolve');
|
const nodeResolve = require('rollup-plugin-node-resolve');
|
||||||
const commonjs = require('rollup-plugin-commonjs');
|
const commonjs = require('rollup-plugin-commonjs');
|
||||||
async function rollupModule(options) {
|
async function rollupModule(options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user