diff --git a/build/lib/i18n.js b/build/lib/i18n.js index e884fc832b2..40702093e5c 100644 --- a/build/lib/i18n.js +++ b/build/lib/i18n.js @@ -463,7 +463,7 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) { }); } function processNlsFiles(opts) { - return (0, event_stream_1.through)(function (file) { + return event_stream_1.through(function (file) { let fileName = path.basename(file.path); if (fileName === 'nls.metadata.json') { let json = null; @@ -515,7 +515,7 @@ function getResource(sourceFile) { } exports.getResource = getResource; function createXlfFilesForCoreBundle() { - return (0, event_stream_1.through)(function (file) { + return event_stream_1.through(function (file) { const basename = path.basename(file.path); if (basename === 'nls.metadata.json') { if (file.isBuffer()) { @@ -566,7 +566,7 @@ function createXlfFilesForExtensions() { let counter = 0; let folderStreamEnded = false; let folderStreamEndEmitted = false; - return (0, event_stream_1.through)(function (extensionFolder) { + return event_stream_1.through(function (extensionFolder) { const folderStream = this; const stat = fs.statSync(extensionFolder.path); if (!stat.isDirectory()) { @@ -584,7 +584,7 @@ function createXlfFilesForExtensions() { } return _xlf; } - gulp.src([`.build/extensions/${extensionName}/package.nls.json`, `.build/extensions/${extensionName}/**/nls.metadata.json`], { allowEmpty: true }).pipe((0, event_stream_1.through)(function (file) { + gulp.src([`.build/extensions/${extensionName}/package.nls.json`, `.build/extensions/${extensionName}/**/nls.metadata.json`], { allowEmpty: true }).pipe(event_stream_1.through(function (file) { if (file.isBuffer()) { const buffer = file.contents; const basename = path.basename(file.path); @@ -643,15 +643,14 @@ function createXlfFilesForExtensions() { } exports.createXlfFilesForExtensions = createXlfFilesForExtensions; function createXlfFilesForIsl() { - return (0, event_stream_1.through)(function (file) { + return event_stream_1.through(function (file) { let projectName, resourceFile; - if (path.basename(file.path) === 'Default.isl') { + if (path.basename(file.path) === 'messages.en.isl') { projectName = setupProject; - resourceFile = 'setup_default.xlf'; + resourceFile = 'messages.xlf'; } else { - projectName = workbenchProject; - resourceFile = 'setup_messages.xlf'; + throw new Error(`Unknown input file ${file.path}`); } let xlf = new XLF(projectName), keys = [], messages = []; let model = new TextModel(file.contents.toString()); @@ -697,7 +696,7 @@ exports.createXlfFilesForIsl = createXlfFilesForIsl; function pushXlfFiles(apiHostname, username, password) { let tryGetPromises = []; let updateCreatePromises = []; - return (0, event_stream_1.through)(function (file) { + return event_stream_1.through(function (file) { const project = path.dirname(file.relative); const fileName = path.basename(file.path); const slug = fileName.substr(0, fileName.length - '.xlf'.length); @@ -759,7 +758,7 @@ function getAllResources(project, apiHostname, username, password) { function findObsoleteResources(apiHostname, username, password) { let resourcesByProject = Object.create(null); resourcesByProject[extensionsProject] = [].concat(exports.externalExtensionsWithTranslations); // clone - return (0, event_stream_1.through)(function (file) { + return event_stream_1.through(function (file) { const project = path.dirname(file.relative); const fileName = path.basename(file.path); const slug = fileName.substr(0, fileName.length - '.xlf'.length); @@ -936,7 +935,7 @@ function pullXlfFiles(apiHostname, username, password, language, resources) { const credentials = `${username}:${password}`; let expectedTranslationsCount = resources.length; let translationsRetrieved = 0, called = false; - return (0, event_stream_1.readable)(function (_count, callback) { + return event_stream_1.readable(function (_count, callback) { // Mark end of stream when all resources were retrieved if (translationsRetrieved === expectedTranslationsCount) { return this.emit('end'); @@ -994,7 +993,7 @@ function retrieveResource(language, resource, apiHostname, credentials) { } function prepareI18nFiles() { let parsePromises = []; - return (0, event_stream_1.through)(function (xlf) { + return event_stream_1.through(function (xlf) { let stream = this; let parsePromise = XLF.parse(xlf.contents.toString()); parsePromises.push(parsePromise); @@ -1043,7 +1042,7 @@ function prepareI18nPackFiles(externalExtensions, resultingTranslationPaths, pse let mainPack = { version: i18nPackVersion, contents: {} }; let extensionsPacks = {}; let errors = []; - return (0, event_stream_1.through)(function (xlf) { + return event_stream_1.through(function (xlf) { let project = path.basename(path.dirname(xlf.relative)); let resource = path.basename(xlf.relative, '.xlf'); let contents = xlf.contents.toString(); @@ -1104,15 +1103,12 @@ function prepareI18nPackFiles(externalExtensions, resultingTranslationPaths, pse exports.prepareI18nPackFiles = prepareI18nPackFiles; function prepareIslFiles(language, innoSetupConfig) { let parsePromises = []; - return (0, event_stream_1.through)(function (xlf) { + return event_stream_1.through(function (xlf) { let stream = this; let parsePromise = XLF.parse(xlf.contents.toString()); parsePromises.push(parsePromise); parsePromise.then(resolvedFiles => { resolvedFiles.forEach(file => { - if (path.basename(file.originalFilePath) === 'Default' && !innoSetupConfig.defaultInfo) { - return; - } let translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig); stream.queue(translatedFile); }); @@ -1148,20 +1144,9 @@ function createIslFile(originalFilePath, messages, language, innoSetup) { let key = sections[0]; let translated = line; if (key) { - if (key === 'LanguageName') { - translated = `${key}=${innoSetup.defaultInfo.name}`; - } - else if (key === 'LanguageID') { - translated = `${key}=${innoSetup.defaultInfo.id}`; - } - else if (key === 'LanguageCodePage') { - translated = `${key}=${innoSetup.codePage.substr(2)}`; - } - else { - let translatedMessage = messages[key]; - if (translatedMessage) { - translated = `${key}=${translatedMessage}`; - } + let translatedMessage = messages[key]; + if (translatedMessage) { + translated = `${key}=${translatedMessage}`; } } content.push(translated); diff --git a/build/lib/i18n.ts b/build/lib/i18n.ts index 746c481b262..2f9bc1d711c 100644 --- a/build/lib/i18n.ts +++ b/build/lib/i18n.ts @@ -31,10 +31,6 @@ export interface Language { export interface InnoSetup { codePage: string; //code page for encoding (http://www.jrsoftware.org/ishelp/index.php?topic=langoptionssection) - defaultInfo?: { - name: string; // inno setup language name - id: string; // locale identifier (https://msdn.microsoft.com/en-us/library/dd318693.aspx) - }; } export const defaultLanguages: Language[] = [ @@ -763,12 +759,11 @@ export function createXlfFilesForIsl(): ThroughStream { return through(function (this: ThroughStream, file: File) { let projectName: string, resourceFile: string; - if (path.basename(file.path) === 'Default.isl') { + if (path.basename(file.path) === 'messages.en.isl') { projectName = setupProject; - resourceFile = 'setup_default.xlf'; + resourceFile = 'messages.xlf'; } else { - projectName = workbenchProject; - resourceFile = 'setup_messages.xlf'; + throw new Error(`Unknown input file ${file.path}`); } let xlf = new XLF(projectName), @@ -1278,9 +1273,6 @@ export function prepareIslFiles(language: Language, innoSetupConfig: InnoSetup): parsePromise.then( resolvedFiles => { resolvedFiles.forEach(file => { - if (path.basename(file.originalFilePath) === 'Default' && !innoSetupConfig.defaultInfo) { - return; - } let translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig); stream.queue(translatedFile); }); @@ -1315,17 +1307,9 @@ function createIslFile(originalFilePath: string, messages: Map, language let key = sections[0]; let translated = line; if (key) { - if (key === 'LanguageName') { - translated = `${key}=${innoSetup.defaultInfo!.name}`; - } else if (key === 'LanguageID') { - translated = `${key}=${innoSetup.defaultInfo!.id}`; - } else if (key === 'LanguageCodePage') { - translated = `${key}=${innoSetup.codePage.substr(2)}`; - } else { - let translatedMessage = messages[key]; - if (translatedMessage) { - translated = `${key}=${translatedMessage}`; - } + let translatedMessage = messages[key]; + if (translatedMessage) { + translated = `${key}=${translatedMessage}`; } }