65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { LanguageService } from './language.service';
|
|
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
templateUrl: './app.component.html',
|
|
styleUrls: ['./app.component.css']
|
|
})
|
|
|
|
export class AppComponent {
|
|
|
|
title = 'ZGo';
|
|
|
|
zgoLanguage:string = '';
|
|
vE = {
|
|
mainPriceData : ''
|
|
}
|
|
|
|
constructor(
|
|
private languageService: LanguageService){
|
|
}
|
|
|
|
ngOnInit(){
|
|
//console.log('chgUILanguage() called on ngOnInit ');
|
|
this.chgUILanguage();
|
|
}
|
|
|
|
chgUILanguage() {
|
|
//console.log('MAIN.chgUILanguage Called ');
|
|
this.languageService.getViewElements('main').subscribe({
|
|
next: response => {
|
|
//console.log('response >> ', response );
|
|
//console.log('main_price_data -> ',response.data.main_price_data);
|
|
this.vE.mainPriceData = response.data.main_price_data;
|
|
this.zgoLanguage = response.language;
|
|
},
|
|
error: error => { console.log('Error --> ',error); }
|
|
});
|
|
}
|
|
|
|
usFlagClicked() {
|
|
if ( this.zgoLanguage != 'en-US' ) {
|
|
localStorage.setItem('zgo_language','en-US');
|
|
window.location.reload();
|
|
}
|
|
}
|
|
|
|
esFlagClicked() {
|
|
if ( this.zgoLanguage != 'es-US' ) {
|
|
localStorage.setItem('zgo_language','es-US');
|
|
window.location.reload();
|
|
}
|
|
}
|
|
|
|
brFlagClicked() {
|
|
if ( this.zgoLanguage != 'br-US' ) {
|
|
localStorage.setItem('zgo_language','br-US');
|
|
window.location.reload();
|
|
}
|
|
}
|
|
|
|
}
|
|
|