import { Injectable } from '@angular/core' ; import { SnackBarService } from './snack-bar.service' ; import { LangChangeEvent , TranslateService } from '@ngx-translate/core' ; @ Injectable ( { providedIn : 'root' } ) export class TranslatableSnackBarService { param snackBarService param translateService constructor ( private snackBarService , private translateService ) { this . translateService . onLangChange . subscribe ( ( event ) => { this . translateService . get ( 'snackbarMessages.dismiss' ) . subscribe ( ( res ) => { this . snackBarService . setDefaultAction ( res ) ; } ) ; } ) ; } param { string } key param { Object } interpolateParams param { number } duration open ( key , interpolateParams = { } , duration = SnackBarService . defaultDuration ) { this . translateService . get ( key , interpolateParams ) . subscribe ( ( message ) => { this . snackBarService . open ( message , duration ) ; } ) ; } param { string } key param { Object } interpolateParams openShort ( key , interpolateParams = { } ) { this . open ( key , interpolateParams , SnackBarService . durationShort ) ; } param { string } key param { Object } interpolateParams openLong ( key , interpolateParams = { } ) { this . open ( key , interpolateParams , SnackBarService . durationLong ) ; } }