From ba0e9b3bc6b1f96f66a98cc5b20ab1739d60db81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Mon, 8 Mar 2021 11:54:46 +0100 Subject: [PATCH] Add translation service to DiffService. --- .../app/core/ui-services/diff.service.spec.ts | 2 ++ .../src/app/core/ui-services/diff.service.ts | 23 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/client/src/app/core/ui-services/diff.service.spec.ts b/client/src/app/core/ui-services/diff.service.spec.ts index 953046a1b..2247ffb0b 100644 --- a/client/src/app/core/ui-services/diff.service.spec.ts +++ b/client/src/app/core/ui-services/diff.service.spec.ts @@ -1,6 +1,7 @@ import { inject, TestBed } from '@angular/core/testing'; import { DiffService, ModificationType } from './diff.service'; +import { E2EImportsModule } from '../../../e2e-imports.module'; import { LinenumberingService } from './linenumbering.service'; describe('DiffService', () => { @@ -167,6 +168,7 @@ describe('DiffService', () => { beforeEach(() => { TestBed.configureTestingModule({ + imports: [E2EImportsModule], providers: [DiffService] }); }); diff --git a/client/src/app/core/ui-services/diff.service.ts b/client/src/app/core/ui-services/diff.service.ts index 430a3aeba..c29717ecf 100644 --- a/client/src/app/core/ui-services/diff.service.ts +++ b/client/src/app/core/ui-services/diff.service.ts @@ -1,5 +1,7 @@ import { Injectable } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; + import { LineNumberedString, LinenumberingService, LineNumberRange } from './linenumbering.service'; import { ViewUnifiedChange } from '../../shared/models/motions/view-unified-change'; @@ -240,7 +242,10 @@ export class DiffService { * * @param {LinenumberingService} lineNumberingService */ - public constructor(private readonly lineNumberingService: LinenumberingService) {} + public constructor( + private readonly lineNumberingService: LinenumberingService, + protected translate: TranslateService + ) {} /** * Searches for the line breaking node within the given Document specified by the given lineNumber. @@ -2238,11 +2243,15 @@ export class DiffService { // That's a pretty serious inconsistency that should not happen at all, // we're just doing some basic damage control here. const msg = - 'Inconsistent data.' + + this.translate.instant('Inconsistent data.') + ' ' + - 'A change recommendation or amendment is probably referring to a non-existant line number.' + + this.translate.instant( + 'A change recommendation or amendment is probably referring to a non-existant line number.' + ) + ' ' + - 'If it is an amendment, you can back up its content when editing it and delete it afterwards.'; + this.translate.instant( + 'If it is an amendment, you can back up its content when editing it and delete it afterwards.' + ); return '' + msg + ''; } @@ -2303,9 +2312,11 @@ export class DiffService { // That's a pretty serious inconsistency that should not happen at all, // we're just doing some basic damage control here. const msg = - 'Inconsistent data.' + + this.translate.instant('Inconsistent data.') + ' ' + - 'A change recommendation or amendment is probably referring to a non-existant line number.'; + this.translate.instant( + 'A change recommendation or amendment is probably referring to a non-existant line number.' + ); return '' + msg + ''; }