mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
Resolved merge conflicts.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Component, HostListener, Input, ChangeDetectionStrategy, ViewEncapsulation, OnDestroy, OnInit } from '@angular/core';
|
||||
|
||||
import { Event, NavigationEnd, Router } from '@angular/router';
|
||||
|
||||
import { TranslateService } from 'ng2-translate';
|
||||
|
||||
@Component({
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
encapsulation: ViewEncapsulation.Emulated,
|
||||
@@ -17,12 +18,22 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
|
||||
private routerSubscription: any;
|
||||
|
||||
constructor(private router: Router) {
|
||||
this.collapse();
|
||||
|
||||
private translateSubscription: any;
|
||||
|
||||
example: string;
|
||||
|
||||
data: any = {
|
||||
greeting: 'Hello',
|
||||
recipient: 'World'
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
private onResize(event): void {
|
||||
constructor(public translate: TranslateService, private router: Router) {
|
||||
// this language will be used as a fallback when a translation isn't found in the current language
|
||||
translate.setDefaultLang('en');
|
||||
// the lang to use, if the lang isn't available, it will use the current loader to get them
|
||||
translate.use('en');
|
||||
|
||||
this.collapse();
|
||||
}
|
||||
|
||||
@@ -32,12 +43,23 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
this.collapse();
|
||||
}
|
||||
});
|
||||
this.translateSubscription = this.translate.get('example.with.data', { greeting: 'Hello', recipient: 'DSpace' }).subscribe((translation: string) => {
|
||||
this.example = translation;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.routerSubscription) {
|
||||
this.routerSubscription.unsubscribe();
|
||||
}
|
||||
if (this.translateSubscription) {
|
||||
this.translateSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
private onResize(event): void {
|
||||
this.collapse();
|
||||
}
|
||||
|
||||
private collapse(): void {
|
||||
|
Reference in New Issue
Block a user