@rushstack/localization-utilities
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -77,2 +77,4 @@ import { ITerminal } from '@rushstack/node-core-library'; | ||
ignoreMissingResxComments?: boolean | undefined; | ||
ignoreString?: (resxFilePath: string, stringName: string) => boolean; | ||
processComment?: (comment: string | undefined, resxFilePath: string, stringName: string) => string | undefined; | ||
} | ||
@@ -79,0 +81,0 @@ |
@@ -14,2 +14,4 @@ import { StringValuesTypingsGenerator } from '@rushstack/typings-generator'; | ||
ignoreMissingResxComments?: boolean | undefined; | ||
ignoreString?: (resxFilePath: string, stringName: string) => boolean; | ||
processComment?: (comment: string | undefined, resxFilePath: string, stringName: string) => string | undefined; | ||
} | ||
@@ -16,0 +18,0 @@ /** |
@@ -15,3 +15,4 @@ "use strict"; | ||
constructor(options) { | ||
super(Object.assign(Object.assign({}, options), { fileExtensions: ['.resx', '.resx.json', '.loc.json', '.resjson'], parseAndGenerateTypings: (fileContents, filePath) => { | ||
const { ignoreString, processComment } = options; | ||
super(Object.assign(Object.assign({}, options), { fileExtensions: ['.resx', '.resx.json', '.loc.json', '.resjson'], parseAndGenerateTypings: (fileContents, filePath, resxFilePath) => { | ||
const locFileData = (0, LocFileParser_1.parseLocFile)({ | ||
@@ -27,6 +28,12 @@ filePath: filePath, | ||
for (const stringName in locFileData) { | ||
typings.push({ | ||
exportName: stringName, | ||
comment: locFileData[stringName].comment | ||
}); | ||
if (!(ignoreString === null || ignoreString === void 0 ? void 0 : ignoreString(resxFilePath, stringName))) { | ||
let comment = locFileData[stringName].comment; | ||
if (processComment) { | ||
comment = processComment(comment, resxFilePath, stringName); | ||
} | ||
typings.push({ | ||
exportName: stringName, | ||
comment | ||
}); | ||
} | ||
} | ||
@@ -33,0 +40,0 @@ return { typings }; |
{ | ||
"name": "@rushstack/localization-utilities", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "This plugin contains some useful functions for localization.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55301
592