From 0e2e5e35a0616e754bad0db592741c2b2f020545 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 7 May 2019 17:31:22 +0100 Subject: [PATCH] [ADF-3126] i18n support for info drawer tabs (#4698) * [ADF-3126] i18n support for info drawer tabs * fix tests * code fixes --- .../app/components/file-view/file-view.component.html | 8 ++++---- .../src/app/components/files/files.component.html | 4 ++-- docs/core/components/info-drawer-tab.component.md | 2 +- docs/core/components/info-drawer.component.md | 2 +- lib/core/info-drawer/info-drawer.component.html | 6 +++--- lib/core/info-drawer/info-drawer.component.spec.ts | 10 ++++++++++ lib/core/info-drawer/info-drawer.module.ts | 4 +++- .../task-list/components/task-details.component.html | 6 +++--- 8 files changed, 27 insertions(+), 15 deletions(-) diff --git a/demo-shell/src/app/components/file-view/file-view.component.html b/demo-shell/src/app/components/file-view/file-view.component.html index d14163bbaf..e6274e0b69 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.html +++ b/demo-shell/src/app/components/file-view/file-view.component.html @@ -3,11 +3,11 @@ - + - + - + - +

- + - + -

{{title}}
+
{{ title | translate }}
@@ -9,12 +9,12 @@ {{ contentBlock.icon }} - {{ contentBlock.label }} + {{ contentBlock.label | translate }} diff --git a/lib/core/info-drawer/info-drawer.component.spec.ts b/lib/core/info-drawer/info-drawer.component.spec.ts index 0bdf4d1faf..e69ee72e03 100644 --- a/lib/core/info-drawer/info-drawer.component.spec.ts +++ b/lib/core/info-drawer/info-drawer.component.spec.ts @@ -23,11 +23,14 @@ import { InfoDrawerComponent } from './info-drawer.component'; import { setupTestBed } from '../testing/setupTestBed'; import { CoreModule } from '../core.module'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { of } from 'rxjs'; +import { TranslateService } from '@ngx-translate/core'; describe('InfoDrawerComponent', () => { let element: HTMLElement; let component: InfoDrawerComponent; let fixture: ComponentFixture; + let translateService: TranslateService; setupTestBed({ imports: [ @@ -37,6 +40,9 @@ describe('InfoDrawerComponent', () => { }); beforeEach(() => { + translateService = TestBed.get(TranslateService); + spyOn(translateService, 'get').and.callFake((key) => of(key)); + fixture = TestBed.createComponent(InfoDrawerComponent); element = fixture.nativeElement; component = fixture.componentInstance; @@ -87,6 +93,7 @@ class CustomInfoDrawerComponent extends InfoDrawerComponent { describe('Custom InfoDrawer', () => { let fixture: ComponentFixture; let component: CustomInfoDrawerComponent; + let translateService: TranslateService; setupTestBed({ imports: [ @@ -99,6 +106,9 @@ describe('Custom InfoDrawer', () => { }); beforeEach(() => { + translateService = TestBed.get(TranslateService); + spyOn(translateService, 'get').and.callFake((key) => of(key)); + fixture = TestBed.createComponent(CustomInfoDrawerComponent); fixture.detectChanges(); component = fixture.componentInstance; diff --git a/lib/core/info-drawer/info-drawer.module.ts b/lib/core/info-drawer/info-drawer.module.ts index 897177bc4f..2c493c2de3 100644 --- a/lib/core/info-drawer/info-drawer.module.ts +++ b/lib/core/info-drawer/info-drawer.module.ts @@ -21,6 +21,7 @@ import { MaterialModule } from '../material.module'; import { InfoDrawerLayoutComponent, InfoDrawerTitleDirective, InfoDrawerButtonsDirective, InfoDrawerContentDirective } from './info-drawer-layout.component'; import { InfoDrawerComponent, InfoDrawerTabComponent } from './info-drawer.component'; +import { TranslateModule } from '@ngx-translate/core'; export function declarations() { return [ @@ -36,7 +37,8 @@ export function declarations() { @NgModule({ imports: [ CommonModule, - MaterialModule + MaterialModule, + TranslateModule.forChild() ], declarations: declarations(), exports: declarations() diff --git a/lib/process-services/task-list/components/task-details.component.html b/lib/process-services/task-list/components/task-details.component.html index ac86217905..f1ba932ec0 100644 --- a/lib/process-services/task-list/components/task-details.component.html +++ b/lib/process-services/task-list/components/task-details.component.html @@ -79,8 +79,8 @@
- - + +
- +