File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
projects/train-platform/src Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 10
10
"booking" : {
11
11
"reserveSeatQuestion" : " Möchten Sie einen Sitzplatz reservieren?" ,
12
12
"firstClassQuestion" : " Möchten Sie in der ersten Klasse sitzen?" ,
13
- "bookAction" : " Buchen"
13
+ "bookAction" : " Buchen" ,
14
+ "confirmation" : " Reise gebucht!" ,
15
+ "error" : " Reise konnte nicht gebucht werden!"
14
16
},
15
17
"journey" : {
16
18
"bookAction" : " Buchen"
Original file line number Diff line number Diff line change 10
10
"booking" : {
11
11
"reserveSeatQuestion" : " Do you want to reserve a seat?" ,
12
12
"firstClassQuestion" : " Do you want to sit in first class?" ,
13
- "bookAction" : " Book"
13
+ "bookAction" : " Book" ,
14
+ "confirmation" : " Booked a journey!" ,
15
+ "error" : " Journey could not be booked!"
14
16
},
15
17
"journey" : {
16
18
"bookAction" : " Book"
Original file line number Diff line number Diff line change 1
1
import { Component } from '@angular/core' ;
2
2
import { ActivatedRoute } from '@angular/router' ;
3
3
import { HotToastService } from '@ngneat/hot-toast' ;
4
+ import { TranslateService } from '@ngx-translate/core' ;
4
5
import { BookingService } from '../booking.service' ;
5
6
6
7
@Component ( {
@@ -15,7 +16,8 @@ export class BookingComponent {
15
16
constructor (
16
17
private bookingService : BookingService ,
17
18
private route : ActivatedRoute ,
18
- private toast : HotToastService
19
+ private toast : HotToastService ,
20
+ private translateService : TranslateService
19
21
) { }
20
22
21
23
book ( ) : void {
@@ -26,15 +28,12 @@ export class BookingComponent {
26
28
} )
27
29
. subscribe (
28
30
( ) => {
29
- this . toast
30
- . success ( `Booked a journey with the id ${ this . route . snapshot . params . journeyId } !
31
- Reserved Seat? ${ this . reserveSeat }
32
- First Class? ${ this . firstClass } ` ) ;
31
+ this . toast . success (
32
+ this . translateService . instant ( 'booking.confirmation' )
33
+ ) ;
33
34
} ,
34
35
( ) => {
35
- this . toast . error (
36
- `Journey with the id ${ this . route . snapshot . params . journeyId } could not be booked!`
37
- ) ;
36
+ this . toast . error ( this . translateService . instant ( 'booking.error' ) ) ;
38
37
}
39
38
) ;
40
39
}
You can’t perform that action at this time.
0 commit comments