|
| 1 | +import { Component, OnInit } from '@angular/core'; |
| 2 | +import { AppService } from '../app.service'; |
| 3 | +import { TranslateService } from '@ngx-translate/core'; |
| 4 | +import { CloudAppEventsService, InitData, CloudAppRestService } from '@exlibris/exl-cloudapp-angular-lib'; |
| 5 | +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; |
| 6 | + |
| 7 | +@Component({ |
| 8 | + selector: 'app-translate', |
| 9 | + templateUrl: './translate.component.html', |
| 10 | + styleUrls: ['./translate.component.scss'] |
| 11 | +}) |
| 12 | +export class TranslateComponent implements OnInit { |
| 13 | + initData: InitData; |
| 14 | + policies: { code: string, desc: string }[]; |
| 15 | + today = new Date().toLocaleDateString(); |
| 16 | + blockTypes: any; |
| 17 | + |
| 18 | + constructor( |
| 19 | + private appService: AppService, |
| 20 | + private translate: TranslateService, |
| 21 | + private eventsService: CloudAppEventsService, |
| 22 | + private restService: CloudAppRestService |
| 23 | + ) { } |
| 24 | + |
| 25 | + ngOnInit() { |
| 26 | + this.translate.get('Translate.Title').subscribe(text=>this.appService.setTitle(text)); |
| 27 | + this.eventsService.getInitData().subscribe(data=>this.initData = data); |
| 28 | + this.policies = [ |
| 29 | + { code: 'D', desc: _('Translate.Policies.DAILY') }, |
| 30 | + { code: 'W', desc: _('Translate.Policies.WEEKLY') }, |
| 31 | + { code: 'M', desc: _('Translate.Policies.MONTHLY') }, |
| 32 | + { code: 'Y', desc: _('Translate.Policies.YEARLY') }, |
| 33 | + ]; |
| 34 | + } |
| 35 | + |
| 36 | + hi() { |
| 37 | + alert(this.translate.instant('Translate.Prompt', |
| 38 | + { name: this.initData.user.firstName } ) |
| 39 | + ); |
| 40 | + } |
| 41 | + |
| 42 | +} |
0 commit comments