license import { ɵParsedMessage } from '@angular/localize' ; import { ParsedMessageLegacy } from '../../../cmds/common/util' ; import { TranslationSerializer } from './translation_serializer' ; interface SimpleJsonTranslationFile { locale : string ; translations : Record < string , string > ; } export class JsonTranslationSerializer implements TranslationSerializer { renderFile ( messages , locale ) { const fileObj = { locale , translations : { } } ; messages . forEach ( message => { fileObj . translations [ ( message as ɵParsedMessage ) . id || ( message as ParsedMessageLegacy ) . messageId ] = ( message as ɵParsedMessage ) . text || ( message as ParsedMessageLegacy ) . messageString ; } ) ; return JSON . stringify ( fileObj , null , 2 ) ; } }