zgo/src/app/app.component.ts

65 lines
1.4 KiB
TypeScript
Raw Normal View History

import { Component, OnInit } from '@angular/core';
import { LanguageService } from './language.service';
2021-10-01 20:10:14 +00:00
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
2021-10-01 20:10:14 +00:00
export class AppComponent {
title = 'ZGo';
zgoLanguage:string = '';
vE = {
mainPriceData : ''
}
constructor(
private languageService: LanguageService){
}
ngOnInit(){
2023-05-08 18:45:34 +00:00
//console.log('chgUILanguage() called on ngOnInit ');
this.chgUILanguage();
}
chgUILanguage() {
2023-05-08 18:45:34 +00:00
//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;
},
2023-05-08 18:45:34 +00:00
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();
}
}
2021-10-15 19:14:49 +00:00
brFlagClicked() {
if ( this.zgoLanguage != 'br-US' ) {
localStorage.setItem('zgo_language','br-US');
window.location.reload();
}
}
2021-10-01 20:10:14 +00:00
}