diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 4ea2b6a..38f0978 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -44,7 +44,11 @@ "sidemenu": { "Book Ride": "Book Ride", "My Trips": "My Trips", - "Logout": "Logout" + "Logout": "Logout", + "Network Error": "Network Error", + "No Internet Connection": "No Internet Connection", + "Quit": "Quit", + "Cancel": "Cancel" }, "forgot": { "Forgot Password": "Forgot Password", @@ -61,5 +65,123 @@ "Popular Search": "Popular Search", "Secret key miss match": "Secret key miss match", "No searches found": "No searches found" + }, + "profile": { + "Edit Profile": "Edit Profile", + "Mobile Number": "Mobile Number", + "Enter a valid Mobile": "Enter a valid Mobile", + "Name": "Name", + "Enter a valid Name": "Enter a valid Name", + "Email": "Email", + "Enter a valid Email": "Enter a valid Email", + "Current Password": "Current Password", + "Minimum 6 characters": "Minimum 6 characters", + "New Password": "New Password", + "Confirm Password": "Confirm Password", + "Password Mismatches": "Password Mismatches", + "UPDATE": "UPDATE", + "Secret key miss match": "Secret key miss match", + "Sorry, Please try again": "Sorry, Please try again", + "Invalid Current Password": "Invalid Current Password", + "Profile updated successfully": "Profile updated successfully", + "Please choose an image file": "Please choose an image file" + }, + "ridepop": { + "Fare Breakup": "Fare Breakup", + "km": "km", + "hour": "hour", + "Ride time Rate": "Ride time Rate", + "RIDE NOW": "RIDE NOW", + "RIDE LATER": "RIDE LATER", + "First": "First", + "After": "After", + "Please select a valid date": "Please select a valid date", + "Secret key miss match": "Secret key miss match", + "No data found": "No data found" + }, + "ridenow": { + "Cab Type": "Cab Type", + "Pickup Time": "Pickup Time", + "02 Min from now": "02 Min from now", + "Rate Card": "Rate Card", + "Rate Estimate": "Rate Estimate", + "CONFIRM RIDE": "CONFIRM RIDE", + "CANCEL RIDE": "CANCEL RIDE", + "Secret key miss match": "Secret key miss match", + "No data found": "No data found", + "Please try again": "Please try again" + }, + "ratecard": { + "Fare Breakup": "Fare Breakup", + "For": "For", + "ride": "ride", + "First": "First", + "km": "km", + "After": "After", + "hour": "hour", + "Ride time Rate": "Ride time Rate", + "OKAY": "OKAY" + }, + "coupon" : { + "Add Coupons":"Add Coupons", + "Enter Coupon Code" : "Enter Coupon Code", + "Apply":"Apply", + "Payment Details":"Payment Details", + "Total":"Total", + "Discount":"Discount", + "Due after service":"Due after service", + "CONTINUE":"CONTINUE", + "CANCEL" :"CANCEL", + "Promocode Expired":"Promocode Expired", + "Invalid Promocode":"Invalid Promocode", + "Secret key miss match":"Secret key miss match" + }, + "confirm" : { + "Success":"Success", + "Your booking has been confirmed on" : "Your booking has been confirmed on", + "OKAY" : "OKAY" + }, + "ride" : { + "Quickride Details":"Quickride Details", + "From":"From", + "To":"To", + "Track Driver" : "Track Driver", + "Searching for driver" : "Searching for driver", + "No drivers found" : "No drivers found", + "No drivers are available" : "No drivers are available", + "Please search again" : "Please search again", + "Cancel" : "Cancel", + "Search" : "Search", + "Please try again!" : "Please try again!", + "Secret key miss match" : "Secret key miss match", + "Ratings":"Ratings", + "Something went wrong please try again" : "Something went wrong please try again." + }, + "map":{ + "Map" : "Map", + "From" : "From", + "To" : "To", + "Cancel" : "Cancel" + }, + "rating":{ + "Rate now" : "Rate now", + "Give your rating" : "Give your rating", + "Submit" : "Submit", + "Later" : "Later", + "Please try again!" : "Please try again!", + "Secret key miss match" : "Secret key miss match" + }, + "ridesummary":{ + "Quickride Details" : "Quickride Details", + "From" : "From", + "To" : "To", + "Ratings" : "Ratings", + "Total" : "Total", + "km" : "km", + "Discount" : "Discount", + "Total Price" : "Total Price", + "Close" : "Close", + "Please try again!" : "Please try again!", + "Secret key miss match" : "Secret key miss match" } } \ No newline at end of file diff --git a/src/pages/addcoupon/addcoupon.html b/src/pages/addcoupon/addcoupon.html index 17e9396..d5090e2 100644 --- a/src/pages/addcoupon/addcoupon.html +++ b/src/pages/addcoupon/addcoupon.html @@ -2,7 +2,7 @@ <button ion-button class="nav_btn theme_color floatLeft" (click)="goBack()"> <ion-icon name="ios-arrow-back"></ion-icon> </button> - <div class="nav_header_title floatLeft">Add Coupons</div> + <div class="nav_header_title floatLeft">{{'coupon.Add Coupons'|translate}}</div> <div class="clear"></div> </ion-header> @@ -10,27 +10,27 @@ <div class="cab_coupon_wrapper"> <form [formGroup]="promoForm"> <div class="cab_coupon_box"> - <input class="cab_coupon_input" placeholder="Enter Coupon Code" formControlName="promocode"> + <input class="cab_coupon_input" placeholder="{{'coupon.Enter Coupon Code'|translate}}" formControlName="promocode"> </div> </form> <!-- <p *ngIf="">You don’t seem to have any valid coupons.<br> --> <!-- Invite your friends. Unlock free ride coupons</p> --> - <button ion-button class="cab_coupon_apply" (click)="checkCode()" [disabled]="promoBtn">Apply</button> + <button ion-button class="cab_coupon_apply" (click)="checkCode()" [disabled]="promoBtn">{{'coupon.Apply'|translate}}</button> <div class="cab_coupon_content"> - <p>Payment Details</p> + <p>{{'coupon.Payment Details'|translate}}</p> <li> - <div class="child textLeft">Total</div> + <div class="child textLeft">{{'coupon.Total'|translate}}</div> <div class="child textRight">₹ {{rate[0]}}</div> <div class="clear"></div> </li> <li> - <div class="child textLeft">Discount</div> + <div class="child textLeft">{{'coupon.Discount'|translate}}</div> <div class="child textRight" *ngIf="promo.discount.slice(-1)=='%'">{{promo.discount}}</div> <div class="child textRight" *ngIf="promo.discount.slice(-1)!='%'">₹ {{promo.discount}}</div> <div class="clear"></div> </li> <li> - <div class="child textLeft">Due after service</div> + <div class="child textLeft">{{'coupon.Due after service'|translate}}</div> <div class="child textRight">₹ {{promo.amount}}</div> <div class="clear"></div> </li> @@ -40,8 +40,8 @@ </ion-content> <ion-footer> <div class="cab_footer_btn_bay"> - <button ion-button class="cab_footer_btn floatRight"(click)="pay()">CONTINUE</button> - <button ion-button class="cab_footer_btn floatLeft theme_dark_bg" (click)="goBack()">CANCEL</button> + <button ion-button class="cab_footer_btn floatRight"(click)="pay()">{{'coupon.CONTINUE'|translate}}</button> + <button ion-button class="cab_footer_btn floatLeft theme_dark_bg" (click)="goBack()">{{'coupon.CANCEL'|translate}}</button> <div class="clear"></div> </div> </ion-footer> diff --git a/src/pages/addcoupon/addcoupon.module.ts b/src/pages/addcoupon/addcoupon.module.ts index 04022f8..566d7e8 100644 --- a/src/pages/addcoupon/addcoupon.module.ts +++ b/src/pages/addcoupon/addcoupon.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { AddcouponPage } from './addcoupon'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { AddcouponPage } from './addcoupon'; ], imports: [ IonicPageModule.forChild(AddcouponPage), + TranslateModule ], }) export class AddcouponPageModule {} diff --git a/src/pages/addcoupon/addcoupon.ts b/src/pages/addcoupon/addcoupon.ts index 933331a..93b7517 100644 --- a/src/pages/addcoupon/addcoupon.ts +++ b/src/pages/addcoupon/addcoupon.ts @@ -5,6 +5,7 @@ import { Myservice } from "../../providers/myservice"; import { dataService } from "../../providers/common.service"; import { Storage } from "@ionic/storage"; import { user } from "../../models/mymodel"; +import { TranslateService } from "@ngx-translate/core"; @IonicPage() @Component({ @@ -18,8 +19,9 @@ export class AddcouponPage { local:user; promoBtn:boolean = false; booking:any; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, private formBuilder: FormBuilder, private myservice: Myservice, private data: dataService, private storage:Storage) { + constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, private formBuilder: FormBuilder, private myservice: Myservice, private data: dataService, private storage: Storage, private translate: TranslateService) { this.promoForm = this.formBuilder.group({ promocode: [''], amount: [''], @@ -28,6 +30,16 @@ export class AddcouponPage { } ionViewDidEnter() { + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.booking = this.data.getbookingData() this.booking.promocode = null; this.storage.get('user_data').then(data=>{ @@ -66,7 +78,9 @@ export class AddcouponPage { this.booking.discount = this.promo.discount } else { - this.myservice.show_alert('Error', response.message) + this.translate.get(['coupon.' + response.message]).subscribe(value => { + this.myservice.show_alert('', value['coupon.' + response.message]) + }) } }) } diff --git a/src/pages/confirmride/confirmride.html b/src/pages/confirmride/confirmride.html index 07c9be1..955b378 100644 --- a/src/pages/confirmride/confirmride.html +++ b/src/pages/confirmride/confirmride.html @@ -2,16 +2,16 @@ <button ion-button class="nav_btn theme_color floatLeft"(click)="dismiss()"> <ion-icon name="close"></ion-icon> </button> - <div class="nav_header_title floatLeft">Success</div> + <div class="nav_header_title floatLeft">{{'confirm.Success'|translate}}</div> <div class="clear"></div> </ion-header> <ion-content padding class="theme_dark_bg"> <div class="cab_logo" style="padding-bottom: 20%;"> <img src="assets/img/booking.png"> </div> - <p class="text_white textCenter cab_confirm_p">Your booking has been confirmed<br> -on {{book?.date|date:'fullDate'}}</p> + <p class="text_white textCenter cab_confirm_p">{{'confirm.Your booking has been confirmed on'|translate}}<br> + {{book?.date|date:'fullDate'}}</p> </ion-content> <ion-footer> -<button ion-button class="cab_footer_btn width100 theme_bgcolor text_white" (click)="home()">OKAY</button> +<button ion-button class="cab_footer_btn width100 theme_bgcolor text_white" (click)="home()">{{'confirm.OKAY'|translate}}</button> </ion-footer> diff --git a/src/pages/confirmride/confirmride.module.ts b/src/pages/confirmride/confirmride.module.ts index ec36fb2..594106a 100644 --- a/src/pages/confirmride/confirmride.module.ts +++ b/src/pages/confirmride/confirmride.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { ConfirmridePage } from './confirmride'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { ConfirmridePage } from './confirmride'; ], imports: [ IonicPageModule.forChild(ConfirmridePage), + TranslateModule ], }) export class ConfirmridePageModule {} diff --git a/src/pages/confirmride/confirmride.ts b/src/pages/confirmride/confirmride.ts index 493aac9..e5ca244 100644 --- a/src/pages/confirmride/confirmride.ts +++ b/src/pages/confirmride/confirmride.ts @@ -4,6 +4,7 @@ import { Myservice } from "../../providers/myservice"; import { dataService } from "../../providers/common.service"; import { Storage } from "@ionic/storage"; import { user } from "../../models/mymodel"; +import { TranslateService } from "@ngx-translate/core"; @IonicPage() @Component({ @@ -15,8 +16,9 @@ export class ConfirmridePage { local: user book: any public unregisterBackButtonAction: any; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private myservice: Myservice, private data: dataService, private storage: Storage, public platform: Platform) { + constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private myservice: Myservice, private data: dataService, private storage: Storage, public platform: Platform, private translate: TranslateService) { } ionViewDidEnter() { @@ -35,13 +37,26 @@ export class ConfirmridePage { this.initializeBackButtonCustomHandler(); } else { - this.myservice.show_alert('Failed', 'Please try again') + this.translate.get(['confirm.' + response.message]).subscribe(value => { + this.myservice.show_alert('', value['confirm.' + response.message]) + }) this.navCtrl.pop() } }) } }) + + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + } public initializeBackButtonCustomHandler(): void { diff --git a/src/pages/map/map.html b/src/pages/map/map.html index 34dedc7..1232536 100644 --- a/src/pages/map/map.html +++ b/src/pages/map/map.html @@ -3,7 +3,7 @@ <button ion-button class="nav_btn theme_color floatLeft" (click)="back()"> <ion-icon name="ios-arrow-back"></ion-icon> </button> - <div class="nav_header_title floatLeft">Map</div> + <div class="nav_header_title floatLeft">{{'map.Map'|translate}}</div> <div class="clear"></div> </ion-header> @@ -14,14 +14,14 @@ <div #map id="map"></div> <div class="jr_bottom_distance_card" *ngIf="temp"> <div class="jr_bottom_inside"> - <input class="jr_dest_input from" placeholder="From" [(ngModel)]="bookData.pickArea" [readonly]="true"> - <input class="jr_dest_input to" placeholder="To" [(ngModel)]="bookData.dropArea" [readonly]="true"> + <input class="jr_dest_input from" placeholder="{{'map.From'|translate}}" [(ngModel)]="bookData.pickArea" [readonly]="true"> + <input class="jr_dest_input to" placeholder="{{'map.To'|translate}}" [(ngModel)]="bookData.dropArea" [readonly]="true"> </div> </div> </ion-content> <ion-footer *ngIf="!temp"> <div class="jr_bottom_button_bay"> - <button ion-button class="cab_footer_btn" (click)="cancel()">Cancel</button> + <button ion-button class="cab_footer_btn" (click)="cancel()">{{'map.Cancel'|translate}}</button> </div> </ion-footer> diff --git a/src/pages/map/map.module.ts b/src/pages/map/map.module.ts index f74e195..d3a582f 100644 --- a/src/pages/map/map.module.ts +++ b/src/pages/map/map.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { MapPage } from './map'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { MapPage } from './map'; ], imports: [ IonicPageModule.forChild(MapPage), + TranslateModule ], exports: [ MapPage diff --git a/src/pages/map/map.ts b/src/pages/map/map.ts index fa8b25c..4df29bb 100644 --- a/src/pages/map/map.ts +++ b/src/pages/map/map.ts @@ -4,6 +4,8 @@ import { dataService } from "../../providers/common.service"; import * as firebase from 'firebase'; import { Geolocation } from '@ionic-native/geolocation'; import { Myservice } from "../../providers/myservice"; +import { TranslateService } from "@ngx-translate/core"; +import { Storage } from "@ionic/storage"; declare var google; @IonicPage() @@ -25,11 +27,22 @@ export class MapPage { markers: any; tempLast: any; userMarkers: any; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private geolocation: Geolocation, private myservice: Myservice) { + constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private geolocation: Geolocation, private myservice: Myservice, private translate: TranslateService, private storage:Storage) { } ionViewDidEnter() { + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.geolocation.getCurrentPosition().then((resp) => { this.loadMap(resp.coords.latitude, resp.coords.longitude); this.driver = this.data.getdriverData(); diff --git a/src/pages/profile/profile.html b/src/pages/profile/profile.html index a51355d..b8fe1f1 100644 --- a/src/pages/profile/profile.html +++ b/src/pages/profile/profile.html @@ -2,7 +2,7 @@ <button ion-button class="nav_btn theme_color floatLeft" menuToggle> <ion-icon name="ios-menu"></ion-icon> </button> - <div class="nav_header_title floatLeft">Edit Profile</div> + <div class="nav_header_title floatLeft">{{'profile.Edit Profile'|translate}}</div> <div class="clear"></div> </ion-header> <ion-content padding class="themelogin_background"> @@ -19,60 +19,60 @@ <form [formGroup]="profileForm"> <div class="cab_form_row cab_edit_profile_edit_row"> <div class="cab_phone_number"> - <select class="cab_phone_code floatLeft"> - <option>+91</option> - </select> - <input class="cab_phone_input floatRight cab_call" placeholder="Mobile Number" formControlName="mobile"> + <select class="cab_phone_code floatLeft" formControlName="dial_code"> + <option *ngFor="let code of codes" value=+{{code.dialCode}}>+{{code.dialCode}}</option> + </select> + <input class="cab_phone_input floatRight cab_call" placeholder="{{'profile.Mobile Number'|translate}}" formControlName="mobile"> <div class="clear"></div> </div> </div> <div class="cab_req" *ngIf="profileForm.controls.mobile.invalid && (profileForm.get('mobile').dirty || profileForm.get('mobile').touched)"> - Enter a valid Mobile + {{'profile.Enter a valid Mobile'|translate}} </div> <div class="cab_form_row cab_edit_profile_edit_row"> <div class="cab_phone_number"> - <input class="cab_phone_input cab_user width100" placeholder="Name" formControlName="name"> + <input class="cab_phone_input cab_user width100" placeholder="{{'profile.Name'|translate}}" formControlName="name"> <div class="clear"></div> </div> </div> <div class="cab_req" *ngIf="profileForm.controls.name.invalid && (profileForm.get('name').dirty || profileForm.get('name').touched)"> - Enter a valid Name + {{'profile.Enter a valid Name'|translate}} </div> <div class="cab_form_row cab_edit_profile_edit_row"> <div class="cab_phone_number"> - <input class="cab_phone_input width100" placeholder="Email" type="email" formControlName="email"> + <input class="cab_phone_input width100" placeholder="{{'profile.Email'|translate}}" type="email" formControlName="email"> <div class="clear"></div> </div> </div> <div class="cab_req" *ngIf="profileForm.controls.email.invalid && (profileForm.get('email').dirty || profileForm.get('email').touched)"> - Enter a valid Email + {{'profile.Enter a valid Email'|translate}} </div> <div class="cab_form_row cab_edit_profile_edit_row"> <div class="cab_phone_number"> - <input class="cab_phone_input cab_pass width100" placeholder="Current Password" type="password" formControlName="password"> + <input class="cab_phone_input cab_pass width100" placeholder="{{'profile.Current Password'|translate}}" type="password" formControlName="password"> <div class="clear"></div> </div> </div> <div class="cab_req" *ngIf="profileForm.controls.password.invalid && (profileForm.get('password').dirty || profileForm.get('password').touched)"> - Minimum 6 characters + {{'profile.Minimum 6 characters'|translate}} </div> <div class="cab_form_row cab_edit_profile_edit_row"> <div class="cab_phone_number"> - <input class="cab_phone_input cab_pass width100" placeholder="New Password" type="password" formControlName="new"> + <input class="cab_phone_input cab_pass width100" placeholder="{{'profile.New Password'|translate}}" type="password" formControlName="new"> <div class="clear"></div> </div> </div> <div class="cab_req" *ngIf="profileForm.controls.new.invalid && (profileForm.get('new').dirty || profileForm.get('new').touched)"> - Minimum 6 characters + {{'profile.Minimum 6 characters'|translate}} </div> <div class="cab_form_row cab_edit_profile_edit_row"> <div class="cab_phone_number"> - <input class="cab_phone_input cab_pass width100" placeholder="Confirm Password" type="password" formControlName="confirm"> + <input class="cab_phone_input cab_pass width100" placeholder="{{'profile.Confirm Password'|translate}}" type="password" formControlName="confirm"> <div class="clear"></div> </div> </div> <div class="cab_req" *ngIf="profileForm.controls.confirm.invalid && (profileForm.get('confirm').dirty || profileForm.get('confirm').touched)"> - Password Mismatches + {{'profile.Password Mismatches'|translate}} </div> </form> </div> @@ -80,5 +80,5 @@ </div> </ion-content> <ion-footer> - <button ion-button class="cab_footer_btn width100 text_white" (click)="update()" [disabled]="profileForm.invalid">UPDATE</button> + <button ion-button class="cab_footer_btn width100 text_white" (click)="update()" [disabled]="profileForm.invalid">{{'profile.UPDATE'|translate}}</button> </ion-footer> diff --git a/src/pages/profile/profile.module.ts b/src/pages/profile/profile.module.ts index 2e50101..6e6f7f1 100644 --- a/src/pages/profile/profile.module.ts +++ b/src/pages/profile/profile.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { ProfilePage } from './profile'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { ProfilePage } from './profile'; ], imports: [ IonicPageModule.forChild(ProfilePage), + TranslateModule ], }) export class ProfilePageModule {} diff --git a/src/pages/profile/profile.ts b/src/pages/profile/profile.ts index 2f407cd..38950c5 100644 --- a/src/pages/profile/profile.ts +++ b/src/pages/profile/profile.ts @@ -6,6 +6,8 @@ import { Storage } from '@ionic/storage'; import { Http } from '@angular/http' import { OrderbyPipe } from '../../providers/sort-pipe'; import { user } from "../../models/mymodel"; +import { TranslateService } from '@ngx-translate/core'; + @IonicPage() @Component({ selector: 'page-profile', @@ -17,8 +19,9 @@ export class ProfilePage { local:user image:boolean = false; formdata = new FormData(); + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, private formBuilder: FormBuilder, private myservice: Myservice, private http: Http, private orderbyPipe: OrderbyPipe, public storage: Storage,private events:Events) { + constructor(public navCtrl: NavController, public navParams: NavParams, private formBuilder: FormBuilder, private myservice: Myservice, private http: Http, private orderbyPipe: OrderbyPipe, public storage: Storage, private events: Events, private translate: TranslateService) { this.profileForm = this.formBuilder.group({ name: ['', Validators.compose([Validators.required, Validators.minLength(3)])], @@ -40,6 +43,17 @@ export class ProfilePage { } ionViewDidEnter(){ + + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.storage.get('user_data').then(data=>{ if(data){ this.local = data @@ -78,7 +92,9 @@ export class ProfilePage { } else{ this.myservice.hide_loader() - this.myservice.show_alert('',response.message) + this.translate.get(['profile.' + response.message]).subscribe(value => { + this.myservice.show_alert('', value['profile.' + response.message]) + }) } }) } @@ -103,7 +119,9 @@ export class ProfilePage { this.image = true; } else { - this.myservice.show_alert("Error","Please choose an image file") + this.translate.get(['profile.Please choose an image file']).subscribe(value => { + this.myservice.show_alert('', value['profile.Please choose an image file']) + }) } } } diff --git a/src/pages/ratecard/ratecard.html b/src/pages/ratecard/ratecard.html index f4df648..0bd3f6e 100644 --- a/src/pages/ratecard/ratecard.html +++ b/src/pages/ratecard/ratecard.html @@ -8,27 +8,27 @@ <p>{{rates[0].cartype}}</p> <!-- <h6>Toyota Etios, Ford Fiesta</h6> --> - <div class="cab_ride_fare_break">Fare Breakup</div> + <div class="cab_ride_fare_break">{{'ratecard.Fare Breakup'|translate}}</div> <ion-grid> <div *ngFor="let rate of rates" class="txt_cntr"> - <span class="clr_wht">For {{rate.timetype}} time ride</span> + <span class="clr_wht">{{'ratecard.For'|translate}} {{rate.timetype}} {{'ratecard.ride'|translate}}</span> <ion-row class="textCenter"> <ion-col col-4> <strong>₹ {{rate.intailrate}}</strong> - <h5>First {{rate.intialkm}}km</h5> + <h5>{{'ratecard.First'|translate}} {{rate.intialkm}}{{'ratecard.km'|translate}}</h5> </ion-col> <ion-col col-4> - <strong>₹ {{rate.standardrate}}/km</strong> - <h5>After {{rate.intialkm}}km</h5> + <strong>₹ {{rate.standardrate}}/{{'ratecard.km'|translate}}</strong> + <h5>{{'ratecard.After'|translate}} {{rate.intialkm}}{{'ratecard.km'|translate}}</h5> </ion-col> <ion-col col-4> - <strong>₹ {{rate.extrahour}}/hr</strong> - <h5>Ride time Rate</h5> + <strong>₹ {{rate.extrahour}}/{{'ratecard.hour'|translate}}</strong> + <h5>{{'ratecard.Ride time Rate'|translate}}</h5> </ion-col> </ion-row> </div> </ion-grid> - <h6 class="bottom0">Peak time charges may apply.</h6> + <!-- <h6 class="bottom0">Peak time charges may apply.</h6> --> <!-- <div class="cab_trip_detail_wrapper"> <h4 class="text_white">Pickup Point</h4> <p class="floatLeft textLeft width50">North Sarovar Road,E City</p> @@ -46,5 +46,5 @@ </div> </ion-content> <ion-footer> -<button ion-button class="cab_footer_btn width100" (click)="dismiss()">OKAY</button> +<button ion-button class="cab_footer_btn width100" (click)="dismiss()">{{'ratecard.OKAY'|translate}}</button> </ion-footer> \ No newline at end of file diff --git a/src/pages/ratecard/ratecard.module.ts b/src/pages/ratecard/ratecard.module.ts index 1918882..c9faaaf 100644 --- a/src/pages/ratecard/ratecard.module.ts +++ b/src/pages/ratecard/ratecard.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { RatecardPage } from './ratecard'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { RatecardPage } from './ratecard'; ], imports: [ IonicPageModule.forChild(RatecardPage), + TranslateModule ], }) export class RatecardPageModule {} diff --git a/src/pages/ratecard/ratecard.ts b/src/pages/ratecard/ratecard.ts index 670ac22..6d0729b 100644 --- a/src/pages/ratecard/ratecard.ts +++ b/src/pages/ratecard/ratecard.ts @@ -1,6 +1,8 @@ import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams,ViewController } from 'ionic-angular'; import { dataService } from "../../providers/common.service"; +import { TranslateService } from '@ngx-translate/core'; +import { Storage } from "@ionic/storage"; @IonicPage() @Component({ @@ -9,14 +11,23 @@ import { dataService } from "../../providers/common.service"; }) export class RatecardPage { rates:any; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private data: dataService) { + constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private data: dataService, private translate: TranslateService, private storage: Storage) { this.rates = this.data.getrateData() console.log(this.rates) } - ionViewDidLoad() { - console.log('ionViewDidLoad RatecardPage'); + ionViewDidEnter(){ + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) } dismiss() diff --git a/src/pages/ratting/ratting.module.ts b/src/pages/ratting/ratting.module.ts index d7b2599..f24647b 100644 --- a/src/pages/ratting/ratting.module.ts +++ b/src/pages/ratting/ratting.module.ts @@ -2,13 +2,16 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { RattingPage } from './ratting'; import { Ionic2RatingModule } from 'ionic2-rating'; +import { TranslateModule } from "@ngx-translate/core"; + @NgModule({ declarations: [ RattingPage, ], imports: [ IonicPageModule.forChild(RattingPage), - Ionic2RatingModule + Ionic2RatingModule, + TranslateModule ], }) export class RattingPageModule {} diff --git a/src/pages/ratting/ratting.ts b/src/pages/ratting/ratting.ts index a6cc452..1cfcaab 100644 --- a/src/pages/ratting/ratting.ts +++ b/src/pages/ratting/ratting.ts @@ -5,6 +5,7 @@ import { Storage } from "@ionic/storage"; import { user } from "../../models/mymodel"; import { dataService } from "../../providers/common.service"; import { Toast } from "@ionic-native/toast"; +import { TranslateService } from "@ngx-translate/core"; @IonicPage() @Component({ @@ -15,15 +16,25 @@ export class RattingPage { driver = this.navParams.get('driver') rate:number; local:user; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams,public viewCtrl:ViewController, private myservice: Myservice, private storage:Storage, private comData:dataService, private toast:Toast) { + constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private myservice: Myservice, private storage: Storage, private comData: dataService, private toast: Toast, private translate: TranslateService) { } ionViewDidEnter() { + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.storage.get('user_data').then(data=>{ if(data){ this.local = data - } }) } @@ -43,14 +54,18 @@ export class RattingPage { this.myservice.hide_loader() if (response.status == 'success') { this.navCtrl.setRoot('HomePage') - - this.toast.show(response.message, '2000', 'center').subscribe( - toast => { - console.log(toast); - }); + + this.translate.get(['rating.' + response.message]).subscribe(value => { + this.toast.show(value['rating.' + response.message], '2000', 'center').subscribe( + toast => { + console.log(toast); + }); + }) } else { - this.myservice.show_alert('', response.message) + this.translate.get(['rating.' + response.message]).subscribe(value => { + this.myservice.show_alert('', value['rating.' + response.message]) + }) } }) } diff --git a/src/pages/ridedetail/ridedetail.html b/src/pages/ridedetail/ridedetail.html index fe90496..c587822 100644 --- a/src/pages/ridedetail/ridedetail.html +++ b/src/pages/ridedetail/ridedetail.html @@ -12,7 +12,7 @@ <button ion-button class="nav_btn theme_color floatLeft" (click)="back()"> <ion-icon name="ios-arrow-back"></ion-icon> </button> - <div class="nav_header_title floatLeft">Quickride Details</div> + <div class="nav_header_title floatLeft">{{'ride.Quickride Details|translate'}}</div> <div class="clear"></div> </ion-header> @@ -21,13 +21,13 @@ <div class="jr_profile_content1"> <div class="jr_from_to"> <li> - <div class="child1 from">From<div class="jr_box1"></div></div> + <div class="child1 from">{{'ride.From'|translate}}<div class="jr_box1"></div></div> <div class="child2"><strong>{{loc.from}}</strong> <p>{{loc.fromAd}}</p></div> <div class="jr_clear"></div> </li> <li> - <div class="child1 to">To</div> + <div class="child1 to">{{'ride.To'|translate}}</div> <div class="child2"><strong>{{loc.to}}</strong> <p>{{loc.toAd}}</p></div> <div class="jr_clear"></div> @@ -44,13 +44,13 @@ <div class="jr_search_profile_detail"> <br> <h6>{{driver.name}} {{driver.age}} Y/O</h6> - <span class="jr_star_ratting"><img src="assets/img/jr_star.png"><strong>{{driver.rating}}/5</strong>{{driver.ratingCount}} Ratings</span><br> + <span class="jr_star_ratting"><img src="assets/img/jr_star.png"><strong>{{driver.rating}}/5</strong>{{driver.ratingCount}} {{'ride.Ratings'|translate}}</span><br> </div> <div class="jr_clear"></div> </div> <div class="jr_bottom_button_bay"> - <button ion-button class="cab_footer_btn" (click)="track()">Track Driver</button> + <button ion-button class="cab_footer_btn" (click)="track()">{{'ride.Track Driver'|translate}}</button> </div> </div> diff --git a/src/pages/ridedetail/ridedetail.module.ts b/src/pages/ridedetail/ridedetail.module.ts index be2c7f6..c31f234 100644 --- a/src/pages/ridedetail/ridedetail.module.ts +++ b/src/pages/ridedetail/ridedetail.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { RidedetailPage } from './ridedetail'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { RidedetailPage } from './ridedetail'; ], imports: [ IonicPageModule.forChild(RidedetailPage), + TranslateModule ], exports: [ RidedetailPage diff --git a/src/pages/ridedetail/ridedetail.ts b/src/pages/ridedetail/ridedetail.ts index 38476fc..559e6e1 100644 --- a/src/pages/ridedetail/ridedetail.ts +++ b/src/pages/ridedetail/ridedetail.ts @@ -5,6 +5,7 @@ import { Myservice } from "../../providers/myservice"; import { Storage } from "@ionic/storage"; import { user } from "../../models/mymodel"; import * as firebase from 'firebase'; +import { TranslateService } from "@ngx-translate/core"; declare var google; @IonicPage() @@ -24,21 +25,36 @@ export class RidedetailPage { bkid: any; drivers = [] temp: boolean = false; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, public loadingCtrl: LoadingController, private alertCtrl: AlertController) { + constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, public loadingCtrl: LoadingController, private alertCtrl: AlertController, private translate: TranslateService) { } ionViewDidEnter() { + + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.initializeBackButtonCustomHandler(); + this.storage.get('user_data').then(data => { if (data) { this.local = data this.book = this.data.getbookingData() console.log(this.book) - this.loader = this.loadingCtrl.create({ - content: "Searching for driver" - }); + this.translate.get(['ride.Searching for driver']).subscribe(value => { + this.loader = this.loadingCtrl.create({ + content: value['ride.Searching for driver'] + }); + }) this.loader.present(); this.findDrivers() @@ -99,7 +115,9 @@ export class RidedetailPage { if (i == res_arr.length - 1) { if (This.drivers.length == 0) { This.loader.dismissAll(); - This.myservice.show_alert('', 'No drivers found') + This.translate.get(['ride.No drivers found']).subscribe(value => { + This.myservice.show_alert('', value['ride.No drivers found']) + }) } else if (This.temp == false) { var bdata = { 'book_date': This.book.date, 'drop_area': This.book.dropArea, 'pickup_area': This.book.pickArea, 'taxi_type': This.book.carDetails.car_type, 'amount': '', 'km': '', 'promocode': This.book.promocode, 'token': This.local.token, 'userid': This.local.id, 'type': 'now', 'drivers': [], 'discount': This.book.discount ? This.book.discount : 0, 'pickup_latlng': this.book.pickLat + ',' + this.book.pickLng, 'drop_latlng': this.book.dropLat + ',' + this.book.dropLng } @@ -117,7 +135,9 @@ export class RidedetailPage { This.temp = true } else { - This.myservice.show_alert('Failed', response.message) + This.translate.get(['ride.' + response.message]).subscribe(value => { + This.myservice.show_alert('', value['ride.' + response.message]) + }) This.navCtrl.pop() } }) @@ -129,32 +149,37 @@ export class RidedetailPage { } showAlert() { - let alert = this.alertCtrl.create({ - title: 'No drivers are available', - message: 'Please search again.', + this.translate.get(['ride.No drivers are available', 'ride.Please search again', 'ride.Cancel', 'ride.Search','ride.Searching for driver']).subscribe(value => { + + let alert = this.alertCtrl.create({ + title: value['ride.No drivers are available'], + message: value['ride.Please search again'], buttons: [ { - text: 'Cancel', + text: value['ride.Cancel'], role: 'cancel', handler: () => { } }, { - text: 'Search', + text: value['ride.Search'], handler: () => { - + this.loader = this.loadingCtrl.create({ - content: "Searching for driver" + content: value['ride.Searching for driver'] }); this.loader.present(); - + this.findDrivers() var This = this; setTimeout(() => { This.myservice.load_post({ taxiType: This.book.carDetails.car_type, driversid: This.drivers, bookid: This.bkid }, 'driverPush').subscribe(data => { if (data.status == 'success') - This.checkResp(); - else - This.myservice.show_alert('', data.message) + This.checkResp(); + else{ + This.translate.get(['ride.' + data.message]).subscribe(value => { + This.myservice.show_alert('', value['ride.' + data.message]) + }) + } }) }, 500); } @@ -162,6 +187,7 @@ export class RidedetailPage { ] }); alert.present(); + }) } checkResp() { @@ -175,8 +201,11 @@ export class RidedetailPage { clearInterval(intrvl) This.loader.dismissAll(); } - else - This.myservice.show_alert('',resp.message) + else{ + This.translate.get(['ride.' + resp.message]).subscribe(value => { + This.myservice.show_alert('', value['ride.' + resp.message]) + }) + } }) if (This.count == 12) { clearInterval(intrvl) diff --git a/src/pages/ridenow/ridenow.html b/src/pages/ridenow/ridenow.html index 5b32053..b508340 100644 --- a/src/pages/ridenow/ridenow.html +++ b/src/pages/ridenow/ridenow.html @@ -9,7 +9,7 @@ <ion-col col-6 style="border-right: 1px solid #fff;"> <div class="cab_pop_detail_left floatLeft" [style.backgroundImage]="'url('+ details?.carDetails.car_image +')'"></div> <div class="cab_pop_details floatLeft textLeft"> - <strong>Cab Type</strong> + <strong>{{'ridenow.Cab Type'|translate}}</strong> <h5>{{details?.carDetails?.car_type}}</h5> </div> <div class="clear"></div> @@ -17,16 +17,16 @@ <ion-col col-6> <div class="cab_pop_detail_left floatLeft c6"></div> <div class="cab_pop_details floatLeft textLeft"> - <strong>Pickup Time</strong> - <h5>02 Min from now</h5> + <strong>{{'ridenow.Pickup Time'|translate}}</strong> + <h5>{{'ridenow.02 Min from now'|translate}}</h5> </div> <div class="clear"></div> </ion-col> </ion-row> </ion-grid> <div class="cab_ride_offer"> - <li (click)="ratecard()">Rate Card</li> - <li class="estim_li">Rate Estimate + <li (click)="ratecard()">{{'ridenow.Rate Card'|translate}}</li> + <li class="estim_li">{{'ridenow.Rate Estimate'|translate}} <div class="rate_est">₹ {{totRate}}</div> </li> <div class="clear"></div> @@ -36,8 +36,8 @@ </ion-content> <ion-footer> <div class="cab_footer_btn_bay"> - <button ion-button class="cab_footer_btn floatRight" (click)="addcoupon()">CONFIRM RIDE</button> - <button ion-button class="cab_footer_btn floatLeft" (click)="dismiss()">CANCEL RIDE</button> + <button ion-button class="cab_footer_btn floatRight" (click)="addcoupon()">{{'ridenow.CONFIRM RIDE'|translate}}</button> + <button ion-button class="cab_footer_btn floatLeft" (click)="dismiss()">{{'ridenow.CANCEL RIDE'|translate}}</button> <div class="clear"></div> </div> </ion-footer> diff --git a/src/pages/ridenow/ridenow.module.ts b/src/pages/ridenow/ridenow.module.ts index 9fb2750..cc96aaa 100644 --- a/src/pages/ridenow/ridenow.module.ts +++ b/src/pages/ridenow/ridenow.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { RidenowPage } from './ridenow'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { RidenowPage } from './ridenow'; ], imports: [ IonicPageModule.forChild(RidenowPage), + TranslateModule ], }) export class RidenowPageModule {} diff --git a/src/pages/ridenow/ridenow.ts b/src/pages/ridenow/ridenow.ts index b64a2f3..73c8363 100644 --- a/src/pages/ridenow/ridenow.ts +++ b/src/pages/ridenow/ridenow.ts @@ -2,7 +2,8 @@ import { Component,NgZone } from '@angular/core'; import { IonicPage, NavController, NavParams,ViewController,ModalController } from 'ionic-angular'; import { dataService } from "../../providers/common.service"; import { Myservice } from "../../providers/myservice"; - +import { TranslateService } from '@ngx-translate/core'; +import { Storage } from "@ionic/storage"; declare var google; @IonicPage() @@ -14,19 +15,33 @@ export class RidenowPage { details:any; rates:any; totRate:string; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private data: dataService, private myservice:Myservice,private zone:NgZone) { + constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private data: dataService, private myservice: Myservice, private zone: NgZone, private translate: TranslateService, private storage: Storage) { } ionViewDidEnter() { + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.details = this.data.getbookingData() // console.log(this.details) this.myservice.load_post({ time: this.details.date, type: this.details.carDetails.car_type }, 'getRate').subscribe(response=>{ if(response.status == 'success'){ this.rates = response.data } - else - this.myservice.show_alert('',response.message) + else{ + this.translate.get(['ridenow.' + response.message]).subscribe(value => { + this.myservice.show_alert('', value['ridenow.' + response.message]) + }) + } }) var origin = new google.maps.LatLng(this.details.pickLat, this.details.pickLng) @@ -44,9 +59,9 @@ export class RidenowPage { }, function (response, status) { if (response.originAddresses[0] != '') { console.log(response.rows[0].elements[0]) - This.myservice.load_post({ gdata: response.rows[0].elements[0], car: This.details.carDetails},'getEstimateRate').subscribe(response=>{ - if(response.status == 'success'){ - This.totRate = response.data + This.myservice.load_post({ gdata: response.rows[0].elements[0], car: This.details.carDetails},'getEstimateRate').subscribe(resp=>{ + if(resp.status == 'success'){ + This.totRate = resp.data This.zone.run(() => { }); } }) diff --git a/src/pages/ridepop/ridepop.html b/src/pages/ridepop/ridepop.html index 772bf4e..24fc13f 100644 --- a/src/pages/ridepop/ridepop.html +++ b/src/pages/ridepop/ridepop.html @@ -6,24 +6,24 @@ </div> <p>{{carTypes[carIndex].car_type}}</p> <!-- <h6>Toyota Etios, Ford Fiesta</h6> --> - <div class="cab_ride_fare_break">Fare Breakup</div> + <div class="cab_ride_fare_break">{{'ridepop.Fare Breakup'|translate}}</div> <ion-grid> <ion-row class="textCenter"> <ion-col col-4> <strong>₹ {{carTypes[carIndex].intailrate}}</strong> - <h5>First {{carTypes[carIndex].intialkm}}km</h5> + <h5>{{'ridepop.First'|translate}} {{carTypes[carIndex].intialkm}}{{'ridepop.km'|translate}}</h5> </ion-col> <ion-col col-4> - <strong>₹ {{carTypes[carIndex].standardrate}}/km</strong> - <h5>After {{carTypes[carIndex].intialkm}}km</h5> + <strong>₹ {{carTypes[carIndex].standardrate}}/{{'ridepop.km'|translate}}</strong> + <h5>{{'ridepop.After'|translate}} {{carTypes[carIndex].intialkm}}{{'ridepop.km'|translate}}</h5> </ion-col> <ion-col col-4> - <strong>₹ {{carTypes[carIndex].extrahour}}/hour</strong> - <h5>Ride time Rate</h5> + <strong>₹ {{carTypes[carIndex].extrahour}}/{{'ridepop.hour'|translate}}</strong> + <h5>{{'ridepop.Ride time Rate'|translate}}</h5> </ion-col> </ion-row> </ion-grid> - <h6 class="bottom0">Peak time charges may apply.</h6> + <!-- <h6 class="bottom0">Peak time charges may apply.</h6> --> <div class="cab_ride_bottom_section"> <li class="c1" *ngFor="let car of carTypes; let i = index;" [style.backgroundImage]="'url('+ car.car_image +')'" (click)="carClick(i)"> <p>{{car.car_type}}</p> @@ -35,9 +35,9 @@ </ion-content> <ion-footer> <div class="cab_footer_btn_bay"> - <button ion-button class="cab_footer_btn floatRight" (click)="bookNow()">RIDE NOW + <button ion-button class="cab_footer_btn floatRight" (click)="bookNow()">{{'ridepop.RIDE NOW'|translate}} </button> - <button ion-button class="cab_footer_btn floatLeft" (click)="bookLater()">RIDE LATER + <button ion-button class="cab_footer_btn floatLeft" (click)="bookLater()">{{'ridepop.RIDE LATER'|translate}} </button> <div class="clear"></div> </div> diff --git a/src/pages/ridepop/ridepop.module.ts b/src/pages/ridepop/ridepop.module.ts index f8d325e..2f054b0 100644 --- a/src/pages/ridepop/ridepop.module.ts +++ b/src/pages/ridepop/ridepop.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { RidepopPage } from './ridepop'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { RidepopPage } from './ridepop'; ], imports: [ IonicPageModule.forChild(RidepopPage), + TranslateModule ], }) export class RidepopPageModule {} diff --git a/src/pages/ridepop/ridepop.ts b/src/pages/ridepop/ridepop.ts index 17f8c33..5920810 100644 --- a/src/pages/ridepop/ridepop.ts +++ b/src/pages/ridepop/ridepop.ts @@ -4,6 +4,8 @@ import { Myservice } from "../../providers/myservice"; import { cartype } from "../../models/mymodel"; import { DatePicker } from '@ionic-native/date-picker'; import { dataService } from "../../providers/common.service"; +import { TranslateService } from '@ngx-translate/core'; +import { Storage } from "@ionic/storage"; @IonicPage() @Component({ @@ -14,11 +16,22 @@ export class RidepopPage { carTypes:Array<cartype> carIndex:number = 0; locData:any; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private myservice: Myservice, private datePicker: DatePicker, private data: dataService, public modalCtrl: ModalController) { + constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private myservice: Myservice, private datePicker: DatePicker, private data: dataService, public modalCtrl: ModalController, private translate: TranslateService, private storage:Storage) { } ionViewDidEnter() { + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.locData = this.data.getbookingData() console.log(this.locData) this.myservice.show_loader() @@ -28,7 +41,9 @@ export class RidepopPage { this.carTypes = response.data } else{ - this.myservice.show_alert('Failed',response.message) + this.translate.get(['ridepop.' + response.message]).subscribe(value => { + this.myservice.show_alert('', value['ridepop.' + response.message]) + }) } }) } @@ -48,7 +63,9 @@ export class RidepopPage { }).then( date =>{ if (date < new Date()){ - this.myservice.show_alert('Error','Please select a valid date') + this.translate.get(['ridepop.Please select a valid date']).subscribe(value => { + this.myservice.show_alert('', value['ridepop.Please select a valid date']) + }) } else{ console.log('1', date) diff --git a/src/pages/ridesummary/ridesummary.html b/src/pages/ridesummary/ridesummary.html index 708098c..236f0db 100644 --- a/src/pages/ridesummary/ridesummary.html +++ b/src/pages/ridesummary/ridesummary.html @@ -12,7 +12,7 @@ <ion-header class="jr_theme_color jr_header"> <button ion-button class="jr_left jr_header_btn jr_back_icon" (click)="goBack()"></button> <div class="jr_header_title"> - <h4>Quickride Details</h4> + <h4>{{'ridesummary.Quickride Details'|translate}}</h4> </div> <button ion-button class="jr_right jr_header_btn"></button> <div class="jr_clear"></div> @@ -23,7 +23,7 @@ <div class="jr_profile_content1"> <div class="jr_from_to"> <li> - <div class="child1 from">From + <div class="child1 from">{{'ridesummary.From'|translate}} <div class="jr_box1"></div> </div> <div class="child2"> @@ -33,7 +33,7 @@ <div class="jr_clear"></div> </li> <li> - <div class="child1 to">To</div> + <div class="child1 to">{{'ridesummary.To'|translate}}</div> <div class="child2"> <strong>{{loc.to}}</strong> <p>{{loc.toAd}}</p> @@ -54,7 +54,7 @@ <h6>{{driver.name}} {{driver.age}} Y/O</h6> <span class="jr_star_ratting"> <img src="assets/img/jr_star.png"> - <strong>{{driver.rating}}/5</strong>{{driver.ratingCount}} Ratings</span> + <strong>{{driver.rating}}/5</strong>{{driver.ratingCount}} {{'ridesummary.Ratings'|translate}}</span> <br> </div> <div class="jr_clear"></div> @@ -71,21 +71,21 @@ </ion-col> --> <ion-col col-4 class="jr_padding0"> <div class="jr_car_info_detail jr_padding0"> - <p>Total</p> - <h6>{{ride?.km}} km</h6> + <p>{{'ridesummary.Total'|translate}}</p> + <h6>{{ride?.km}} {{'ridesummary.km'|translate}}</h6> </div> <div class="jr_clear"></div> </ion-col> <ion-col col-4 class="jr_padding0"> <div class="jr_car_info_detail jr_padding0"> - <p>Discount</p> + <p>{{'ridesummary.Discount'|translate}}</p> <h6>Rs. {{ride?.discount}}</h6> </div> <div class="jr_clear"></div> </ion-col> <ion-col col-4 class="jr_padding0 right"> <div class="jr_car_info_detail jr_padding0"> - <p>Total Price</p> + <p>{{'ridesummary.Total Price'|translate}}</p> <h6>Rs. {{ride?.amount}}</h6> </div> <div class="jr_clear"></div> @@ -97,7 +97,7 @@ </div> <div class="jr_bottom_button_bay"> - <button ion-button class="jr_offer_ride2" (click)="close()">Close</button> + <button ion-button class="jr_offer_ride2" (click)="close()">{{'ridesummary.Close'|translate}}</button> </div> </div> diff --git a/src/pages/ridesummary/ridesummary.module.ts b/src/pages/ridesummary/ridesummary.module.ts index 54053f6..d731758 100644 --- a/src/pages/ridesummary/ridesummary.module.ts +++ b/src/pages/ridesummary/ridesummary.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { RidesummaryPage } from './ridesummary'; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ declarations: [ @@ -8,6 +9,7 @@ import { RidesummaryPage } from './ridesummary'; ], imports: [ IonicPageModule.forChild(RidesummaryPage), + TranslateModule ], }) export class RidesummaryPageModule {} diff --git a/src/pages/ridesummary/ridesummary.ts b/src/pages/ridesummary/ridesummary.ts index 3ee8d12..c02a20d 100644 --- a/src/pages/ridesummary/ridesummary.ts +++ b/src/pages/ridesummary/ridesummary.ts @@ -5,6 +5,7 @@ import { Myservice } from "../../providers/myservice"; import { Storage } from "@ionic/storage"; import { user } from "../../models/mymodel"; import * as firebase from 'firebase'; +import { TranslateService } from "@ngx-translate/core"; declare var google; @IonicPage() @@ -20,11 +21,22 @@ export class RidesummaryPage { public unregisterBackButtonAction: any; driver: any; ride: any; + lang: string = 'en'; - constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform) { + constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, private translate: TranslateService) { } ionViewDidEnter() { + this.storage.get('lang').then(lang => { + if (lang != null) { + this.translate.use(lang) + this.lang = lang; + } + else { + this.translate.use('en') + } + }) + this.initializeBackButtonCustomHandler(); this.storage.get('user_data').then(data => { if (data) { @@ -82,8 +94,11 @@ export class RidesummaryPage { } } } - else - this.myservice.show_alert('',resp.message) + else{ + this.translate.get(['ridesummary.' + resp.message]).subscribe(value => { + this.myservice.show_alert('', value['ridesummary.' + resp.message]) + }) + } }) }