mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
initial i18n messages for loading and error components
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-error',
|
||||
styleUrls: ['./error.component.scss'],
|
||||
@@ -9,4 +13,24 @@ export class ErrorComponent {
|
||||
|
||||
@Input() message = 'Error...';
|
||||
|
||||
private subscription: Subscription;
|
||||
|
||||
constructor(private translate: TranslateService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.message === undefined) {
|
||||
this.subscription = this.translate.get('error.default').subscribe((message: string) => {
|
||||
this.message = message;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.subscription !== undefined) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user