From b1d40cff89f7cff565a98cdbcea9a624196a169a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Jun 2018 16:21:17 +0200 Subject: Add i18n attributes --- client/src/app/shared/guards/can-deactivate-guard.service.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client/src/app/shared/guards') diff --git a/client/src/app/shared/guards/can-deactivate-guard.service.ts b/client/src/app/shared/guards/can-deactivate-guard.service.ts index 550dd656e..c038a5c0e 100644 --- a/client/src/app/shared/guards/can-deactivate-guard.service.ts +++ b/client/src/app/shared/guards/can-deactivate-guard.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core' import { ActivatedRouteSnapshot, CanDeactivate, RouterStateSnapshot } from '@angular/router' import { Observable } from 'rxjs' import { ConfirmService } from '../../core/index' +import { I18n } from '@ngx-translate/i18n-polyfill' export interface CanComponentDeactivate { canDeactivate: () => { text?: string, canDeactivate: Observable | boolean } @@ -9,7 +10,10 @@ export interface CanComponentDeactivate { @Injectable() export class CanDeactivateGuard implements CanDeactivate { - constructor (private confirmService: ConfirmService) { } + constructor ( + private confirmService: ConfirmService, + private i18n: I18n + ) { } canDeactivate (component: CanComponentDeactivate, currentRoute: ActivatedRouteSnapshot, @@ -17,11 +21,11 @@ export class CanDeactivateGuard implements CanDeactivate nextState: RouterStateSnapshot ) { const result = component.canDeactivate() - const text = result.text || 'All unsaved data will be lost, are you sure you want to leave this page?' + const text = result.text || this.i18n('All unsaved data will be lost, are you sure you want to leave this page?') return result.canDeactivate || this.confirmService.confirm( text, - 'Warning' + this.i18n('Warning') ) } -- cgit v1.2.3