import { ToolingLog } from '@kbn/dev-utils' ; import { integrateLocaleFiles , I18nConfig } from '..' ; export interface I18nFlags { fix : boolean ; ignoreMalformed : boolean ; ignoreIncompatible : boolean ; ignoreUnused : boolean ; ignoreMissing : boolean ; } export function checkCompatibility ( config , flags , log ) { const { fix , ignoreIncompatible , ignoreUnused , ignoreMalformed , ignoreMissing } = flags ; return config . translations . map ( ( translationsPath ) => ( { task : async ( { messages } ) => { await integrateLocaleFiles ( messages , { dryRun : ! fix , ignoreIncompatible : fix || ignoreIncompatible , ignoreUnused : fix || ignoreUnused , ignoreMissing : fix || ignoreMissing , ignoreMalformed : fix || ignoreMalformed , sourceFileName : translationsPath , targetFileName : fix ? translationsPath : undefined , config , log , } ) ; } , title : `Compatibility check with ${ translationsPath }` , } ) ) ; }