mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Port for locfunc task fix with XLFs and langpack source files. (#16195)
* added on end function to end of pipe * Update for existing localized XLFs. (#16107) * update to existing german extensions * Update for existing Spanish Resources * Added updates to existing French Resources * update for Italian Resources * Update for existing Japanese resources * update for Korean resources * update for Portuguese resources * russian resources updated * update for chinese resources * Removed async copy in rename function * added comments and removed async * added changes to langpacks
This commit is contained in:
@@ -266,18 +266,6 @@ function refreshLangpacks() {
|
||||
if (languageId === "zh-tw") {
|
||||
languageId = "zh-hant";
|
||||
}
|
||||
//remove extensions not part of ADS.
|
||||
if (fs.existsSync(translationDataFolder)) {
|
||||
let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions'));
|
||||
for (let extensionTag in totalExtensions) {
|
||||
let extensionFileName = totalExtensions[extensionTag];
|
||||
let xlfPath = path.join(location, `${languageId}`, extensionFileName.replace('.i18n.json', '.xlf'));
|
||||
if (!(fs.existsSync(xlfPath) || VSCODEExtensions.indexOf(extensionFileName.replace('.i18n.json', '')) !== -1)) {
|
||||
let filePath = path.join(translationDataFolder, 'extensions', extensionFileName);
|
||||
rimraf.sync(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`Importing translations for ${languageId} from '${location}' to '${translationDataFolder}' ...`);
|
||||
let translationPaths = [];
|
||||
gulp.src(path.join(location, languageId, '**', '*.xlf'))
|
||||
@@ -356,6 +344,8 @@ function renameVscodeLangpacks() {
|
||||
}
|
||||
let locADSFolder = path.join('.', 'i18n', `ads-language-pack-${langId}`);
|
||||
let locVSCODEFolder = path.join('.', 'i18n', `vscode-language-pack-${langId}`);
|
||||
let translationDataFolder = path.join(locVSCODEFolder, 'translations');
|
||||
let xlfFolder = path.join('.', 'resources', 'xlf');
|
||||
try {
|
||||
fs.statSync(locVSCODEFolder);
|
||||
}
|
||||
@@ -363,12 +353,26 @@ function renameVscodeLangpacks() {
|
||||
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);
|
||||
// Delete extension files in vscode language pack that are not in ADS.
|
||||
if (fs.existsSync(translationDataFolder)) {
|
||||
let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions'));
|
||||
for (let extensionTag in totalExtensions) {
|
||||
let extensionFileName = totalExtensions[extensionTag];
|
||||
let xlfPath = path.join(xlfFolder, `${langId}`, extensionFileName.replace('.i18n.json', '.xlf'));
|
||||
if (!(fs.existsSync(xlfPath) || VSCODEExtensions.indexOf(extensionFileName.replace('.i18n.json', '')) !== -1)) {
|
||||
let filePath = path.join(translationDataFolder, 'extensions', extensionFileName);
|
||||
rimraf.sync(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Get list of md files in ADS langpack, to copy to vscode langpack prior to renaming.
|
||||
let globArray = glob.sync(path.join(locADSFolder, '*.md'));
|
||||
//Copy files to vscode langpack, then remove the ADS langpack, and finally rename the vscode langpack to match the ADS one.
|
||||
globArray.forEach(element => {
|
||||
fs.copyFileSync(element, path.join(locVSCODEFolder, path.parse(element).base));
|
||||
});
|
||||
rimraf.sync(locADSFolder);
|
||||
fs.renameSync(locVSCODEFolder, locADSFolder);
|
||||
}
|
||||
console.log("Langpack Rename Completed.");
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -287,20 +287,6 @@ export function refreshLangpacks(): Promise<void> {
|
||||
languageId = "zh-hant";
|
||||
}
|
||||
|
||||
//remove extensions not part of ADS.
|
||||
if (fs.existsSync(translationDataFolder)) {
|
||||
let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions'));
|
||||
for (let extensionTag in totalExtensions) {
|
||||
let extensionFileName = totalExtensions[extensionTag];
|
||||
let xlfPath = path.join(location, `${languageId}`, extensionFileName.replace('.i18n.json', '.xlf'))
|
||||
if (!(fs.existsSync(xlfPath) || VSCODEExtensions.indexOf(extensionFileName.replace('.i18n.json', '')) !== -1)) {
|
||||
let filePath = path.join(translationDataFolder, 'extensions', extensionFileName);
|
||||
rimraf.sync(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(`Importing translations for ${languageId} from '${location}' to '${translationDataFolder}' ...`);
|
||||
let translationPaths: any = [];
|
||||
gulp.src(path.join(location, languageId, '**', '*.xlf'))
|
||||
@@ -380,6 +366,8 @@ export function renameVscodeLangpacks(): Promise<void> {
|
||||
}
|
||||
let locADSFolder = path.join('.', 'i18n', `ads-language-pack-${langId}`);
|
||||
let locVSCODEFolder = path.join('.', 'i18n', `vscode-language-pack-${langId}`);
|
||||
let translationDataFolder = path.join(locVSCODEFolder, 'translations');
|
||||
let xlfFolder = path.join('.', 'resources', 'xlf');
|
||||
try {
|
||||
fs.statSync(locVSCODEFolder);
|
||||
}
|
||||
@@ -387,12 +375,28 @@ export function renameVscodeLangpacks(): Promise<void> {
|
||||
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);
|
||||
});
|
||||
// Delete extension files in vscode language pack that are not in ADS.
|
||||
if (fs.existsSync(translationDataFolder)) {
|
||||
let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions'));
|
||||
for (let extensionTag in totalExtensions) {
|
||||
let extensionFileName = totalExtensions[extensionTag];
|
||||
let xlfPath = path.join(xlfFolder, `${langId}`, extensionFileName.replace('.i18n.json', '.xlf'))
|
||||
if (!(fs.existsSync(xlfPath) || VSCODEExtensions.indexOf(extensionFileName.replace('.i18n.json', '')) !== -1)) {
|
||||
let filePath = path.join(translationDataFolder, 'extensions', extensionFileName);
|
||||
rimraf.sync(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Get list of md files in ADS langpack, to copy to vscode langpack prior to renaming.
|
||||
let globArray = glob.sync(path.join(locADSFolder, '*.md'));
|
||||
|
||||
//Copy files to vscode langpack, then remove the ADS langpack, and finally rename the vscode langpack to match the ADS one.
|
||||
globArray.forEach(element => {
|
||||
fs.copyFileSync(element, path.join(locVSCODEFolder,path.parse(element).base));
|
||||
});
|
||||
rimraf.sync(locADSFolder);
|
||||
fs.renameSync(locVSCODEFolder, locADSFolder);
|
||||
}
|
||||
|
||||
console.log("Langpack Rename Completed.");
|
||||
|
||||
Reference in New Issue
Block a user