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:
Alex Ma
2021-07-02 10:58:14 -07:00
committed by GitHub
parent 24b77a6a40
commit ba3ab201c8
7 changed files with 135 additions and 25 deletions

View File

@@ -484,7 +484,7 @@ function processNlsFiles(opts) {
exports.processNlsFiles = processNlsFiles;
const editorProject = 'vscode-editor', workbenchProject = 'vscode-workbench', extensionsProject = 'vscode-extensions', setupProject = 'vscode-setup';
// {{SQL CARBON EDIT}}
const sqlopsProject = 'sqlops-core';
const adsProject = 'ads-core';
function getResource(sourceFile) {
let resource;
if (/^vs\/platform/.test(sourceFile)) {
@@ -515,7 +515,7 @@ function getResource(sourceFile) {
}
// {{SQL CARBON EDIT}}
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}`);
}

View File

@@ -611,7 +611,7 @@ const editorProject: string = 'vscode-editor',
setupProject: string = 'vscode-setup';
// {{SQL CARBON EDIT}}
const sqlopsProject: string = 'sqlops-core';
const adsProject: string = 'ads-core';
export function getResource(sourceFile: string): Resource {
let resource: string;
@@ -638,7 +638,7 @@ export function getResource(sourceFile: string): Resource {
// {{SQL CARBON EDIT}}
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}`);

View File

@@ -4,7 +4,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
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 path = require("path");
const glob = require("glob");
@@ -340,3 +340,37 @@ function refreshLangpacks() {
return Promise.resolve();
}
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;

View File

@@ -362,3 +362,40 @@ export function refreshLangpacks(): Promise<void> {
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();
}

View File

@@ -8,7 +8,7 @@ exports.rollupAngular = void 0;
const fs = require("fs");
const rollup = require("rollup");
const path = require("path");
// getting around stupid import rules
// getting around import rules
const nodeResolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
async function rollupModule(options) {