import { StringValuesTypingsGenerator , IStringValueTyping } from '@rushstack/typings-generator' ; import { ITerminal , NewlineKind } from '@rushstack/node-core-library' ; import { ILocalizationFile } from './interfaces' ; import { LocFileParser } from './utilities/LocFileParser' ; public export interface ITypingsGeneratorOptions { srcFolder : string ; generatedTsFolder : string ; terminal ? : ITerminal ; exportAsDefault ? : boolean ; globsToIgnore ? : string [ ] ; resxNewlineNormalization ? : NewlineKind | undefined ; } public export class LocFileTypingsGenerator extends StringValuesTypingsGenerator { public constructor ( options ) { super ( { ... options , fileExtensions : [ '.resx' , '.resx.json' , '.loc.json' ] , parseAndGenerateTypings : ( fileContents , filePath ) => { const locFileData = LocFileParser . parseLocFile ( { filePath : filePath , content : fileContents , terminal : this . _options . terminal ! , resxNewlineNormalization : options . resxNewlineNormalization } ) ; const typings = [ ] ; for ( const stringName in locFileData ) { typings . push ( { exportName : stringName , comment : locFileData [ stringName ] . comment } ) ; } return { typings } ; } } ) ; } }