import { Pipe, PipeTransform } from '@angular/core'; import { I18nService } from '@yourcause/common/i18n'; @Pipe({ name: 'gcCdtDuplicateValuesAlertMessage' }) export class CdtDuplicateValuesAlertMessagePipe implements PipeTransform { constructor ( private i18n: I18nService ) { } transform ( tableOneHasDuplicateValues: boolean, tableTwoHasDuplicateValues: boolean ) { if (tableOneHasDuplicateValues && tableTwoHasDuplicateValues) { return this.i18n.translate( 'common:textBothDataTablesHaveDuplicates', {}, 'Both custom data tables have duplicate values and cannot be merged.' ); } else if (tableOneHasDuplicateValues) { return this.i18n.translate( 'common:textTableOneHasDuplicateValues', { number: 1 }, 'Custom data table __number__ has duplicate values and cannot be merged.' ); } else if (tableTwoHasDuplicateValues) { return this.i18n.translate( 'common:textTableOneHasDuplicateValues', { number: 2 }, 'Custom data table __number__ has duplicate values and cannot be merged.' ); } return ''; } }