license import { Diagnostics } from '../../common/diagnostics' ; import { ParsedTranslation } from '../translations' ; import { ɵMessageId } from '@angular/localize' ; /**
 * An object that holds translations that have been parsed from a translation file.
 */ export interface ParsedTranslationBundle { locale : string | undefined ; sources ? : Record < ɵMessageId , ParsedTranslation > ; translations : Record < ɵMessageId , ParsedTranslation > ; diagnostics : Diagnostics ; } /**
 * Indicates that a parser can parse a given file, with a hint that can be used to speed up actual
 * parsing.
 */ export interface CanParseAnalysis < Hint > { canParse : true ; diagnostics : Diagnostics ; hint : Hint ; } /**
 * Indicates that a parser cannot parse a given file with diagnostics as why this is.
 * */ export interface CannotParseAnalysis { canParse : false ; diagnostics : Diagnostics ; } /**
 * Information about whether a `TranslationParser` can parse a given file.
 */ export type ParseAnalysis < Hint > = CanParseAnalysis < Hint > | CannotParseAnalysis ; /**
 * Implement this interface to provide a class that can parse the contents of a translation file.
 */ export interface TranslationParser < Hint = true > { param filePath param contents parse ( filePath , contents ) : ParsedTranslationBundle ; param filePath param contents param hint canParse ( filePath , contents , hint ) : Hint | false ; param filePath param contents returns analyze ( filePath , contents ) : ParseAnalysis < Hint > ; }