mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Allow pulling in external extension translations from somewhere else (#176090)
allow pulling in external extension translations from somewhere else This will allow js-debug to push its strings to the extension localization repo and then we will grab the translated strings from there.
This commit is contained in:
parent
529fa01576
commit
8ddd3bcf39
File diff suppressed because one or more lines are too long
|
@ -644,7 +644,7 @@ function createL10nBundleForExtension(extensionFolderName: string, prefixWithBui
|
|||
}));
|
||||
}
|
||||
|
||||
const EXTERNAL_EXTENSIONS = [
|
||||
export const EXTERNAL_EXTENSIONS = [
|
||||
'ms-vscode.js-debug',
|
||||
'ms-vscode.js-debug-companion',
|
||||
'ms-vscode.vscode-js-profile-table',
|
||||
|
@ -844,7 +844,8 @@ export function prepareI18nPackFiles(resultingTranslationPaths: TranslationPath[
|
|||
const errors: any[] = [];
|
||||
return through(function (this: ThroughStream, xlf: File) {
|
||||
const project = path.basename(path.dirname(path.dirname(xlf.relative)));
|
||||
const resource = path.basename(xlf.relative, '.xlf');
|
||||
// strip `-new` since vscode-extensions-loc uses the `-new` suffix to indicate that it's from the new loc pipeline
|
||||
const resource = path.basename(path.basename(xlf.relative, '.xlf'), '-new');
|
||||
const contents = xlf.contents.toString();
|
||||
log(`Found ${project}: ${resource}`);
|
||||
const parsePromise = getL10nFilesFromXlf(contents);
|
||||
|
|
|
@ -23,6 +23,10 @@ function update(options) {
|
|||
if (location !== undefined && !fs.existsSync(location)) {
|
||||
throw new Error(`${location} doesn't exist.`);
|
||||
}
|
||||
let externalExtensionsLocation = options.externalExtensionsLocation;
|
||||
if (externalExtensionsLocation !== undefined && !fs.existsSync(location)) {
|
||||
throw new Error(`${externalExtensionsLocation} doesn't exist.`);
|
||||
}
|
||||
let locExtFolder = idOrPath;
|
||||
if (/^\w{2,3}(-\w+)?$/.test(idOrPath)) {
|
||||
locExtFolder = path.join('..', 'vscode-loc', 'i18n', `vscode-language-pack-${idOrPath}`);
|
||||
|
@ -67,7 +71,10 @@ function update(options) {
|
|||
|
||||
console.log(`Importing translations for ${languageId} form '${location}' to '${translationDataFolder}' ...`);
|
||||
let translationPaths = [];
|
||||
gulp.src(path.join(location, '**', languageId, '*.xlf'), { silent: false })
|
||||
gulp.src([
|
||||
path.join(location, '**', languageId, '*.xlf'),
|
||||
...i18n.EXTERNAL_EXTENSIONS.map(extensionId => path.join(externalExtensionsLocation, extensionId, languageId, '*-new.xlf'))
|
||||
], { silent: false })
|
||||
.pipe(i18n.prepareI18nPackFiles(translationPaths))
|
||||
.on('error', (error) => {
|
||||
console.log(`Error occurred while importing translations:`);
|
||||
|
@ -94,7 +101,7 @@ function update(options) {
|
|||
}
|
||||
if (path.basename(process.argv[1]) === 'update-localization-extension.js') {
|
||||
var options = minimist(process.argv.slice(2), {
|
||||
string: 'location'
|
||||
string: ['location', 'externalExtensionsLocation']
|
||||
});
|
||||
update(options);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue