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:
Alex Ma
2021-07-19 13:50:52 -07:00
committed by GitHub
parent 9577b70e37
commit a430fd2592
252 changed files with 114036 additions and 96018 deletions

View File

@@ -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();

View File

@@ -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.");