UI language management: Working language selection
|
@ -1,9 +1,37 @@
|
||||||
<main>
|
<main >
|
||||||
<router-outlet></router-outlet>
|
<router-outlet ></router-outlet>
|
||||||
|
<!--
|
||||||
|
<app-login (newLanguageEvent) = "chgUILanguage($event)"></app-login>
|
||||||
|
-->
|
||||||
</main>
|
</main>
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
<div align="center">
|
||||||
|
<img *ngIf="zgoLanguage == 'en-US'"
|
||||||
|
src="../assets/zgo-usa-flag-default.png"
|
||||||
|
(click)="usFlagClicked()"
|
||||||
|
height="24px"
|
||||||
|
title="English (Default)"/>
|
||||||
|
<img *ngIf="zgoLanguage != 'en-US'"
|
||||||
|
src="../assets/zgo-usa-flag.png"
|
||||||
|
(click)="usFlagClicked()"
|
||||||
|
height="24px"
|
||||||
|
title="English"/>
|
||||||
|
<img src="../assets/flag-spacer.png"
|
||||||
|
height="24px">
|
||||||
|
<img *ngIf="zgoLanguage == 'es-US'"
|
||||||
|
src="../assets/zgo-spain-flag-default.png"
|
||||||
|
(click)="esFlagClicked()"
|
||||||
|
height="24px"
|
||||||
|
title="Spanish (Default)"/>
|
||||||
|
<img *ngIf="zgoLanguage != 'es-US'"
|
||||||
|
src="../assets/zgo-spain-flag.png"
|
||||||
|
(click)="esFlagClicked()"
|
||||||
|
height="24px"
|
||||||
|
title="Spanish"/>
|
||||||
|
</div>
|
||||||
<div class="footer" align="center">
|
<div class="footer" align="center">
|
||||||
<p>© 2023 Vergara Technologies LLC</p>
|
<p>© 2023 Vergara Technologies LLC</p>
|
||||||
<p class="tiny">Version 1.4.1</p>
|
<p class="tiny">Version 1.4.1</p>
|
||||||
<p class="tiny">Price data provided by CoinGecko API</p>
|
<p class="tiny">{{ vE.mainPriceData }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { LanguageService } from './language.service';
|
||||||
|
import { LanguageData } from './language.model';
|
||||||
|
|
||||||
//import { Post} from './posts/post.model';
|
//import { Post} from './posts/post.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -8,6 +11,49 @@ import { Component } from '@angular/core';
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
title = 'ZGo';
|
|
||||||
|
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(
|
||||||
|
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 => { 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { LanguageData } from './language.model';
|
import { LanguageData } from './language.model';
|
||||||
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
||||||
|
|
||||||
import { ConfigData } from './configdata';
|
import { ConfigData } from './configdata';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
@ -12,37 +11,28 @@ export class LanguageService {
|
||||||
|
|
||||||
private baseURL = 'http://localhost:8080/getlang';
|
private baseURL = 'http://localhost:8080/getlang';
|
||||||
|
|
||||||
|
public zgoLanguage: string = '';
|
||||||
|
|
||||||
constructor(private http:HttpClient) {
|
constructor(private http:HttpClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
httpOptions = {
|
getViewElements ( viewName:string ) {
|
||||||
headers: new HttpHeaders({
|
//
|
||||||
'Content-Type': 'application/json'
|
// Get default language from localStorage
|
||||||
})
|
//
|
||||||
};
|
var def_zgoLanguage = localStorage.getItem('zgo_language');
|
||||||
|
|
||||||
_getViewElements ( viewName:string,
|
|
||||||
encoding:string = 'en-US' ){
|
|
||||||
|
|
||||||
|
|
||||||
const vElem : string = '{' +
|
|
||||||
'"login_confirm_login":"ZGo confirma su ingreso en la cadena de Zcash"' + ',' +
|
|
||||||
'"login_connect_to_zgo":"Conectar su billetera a ZGo"' + ',' +
|
|
||||||
'"login_enter_pin":"Ingrese el PIN enviado por ZGo para confirmar su billetera:"' + ',' +
|
|
||||||
'"login_last_block":"Ultimo Bloque Verificado: "' + ',' +
|
|
||||||
'"login_link_wallet":"Asociar Billetera"' + '}';
|
|
||||||
|
|
||||||
return vElem;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
getViewElements ( viewName:string,
|
|
||||||
encoding:string = 'en-US' ) {
|
|
||||||
|
|
||||||
|
if ( def_zgoLanguage == null ) {
|
||||||
|
this.zgoLanguage = 'en-US';
|
||||||
|
localStorage.setItem('zgo_language',this.zgoLanguage);
|
||||||
|
} else {
|
||||||
|
this.zgoLanguage = def_zgoLanguage;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Get View's text data from language database
|
||||||
|
//
|
||||||
return this.http.get<LanguageData>(this.baseURL +
|
return this.http.get<LanguageData>(this.baseURL +
|
||||||
'/?lang_id=' + encoding +
|
'/?lang_id=' + this.zgoLanguage +
|
||||||
'&viewname=' + viewName);
|
'&viewname=' + viewName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,6 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<mat-card class="centercard">
|
<mat-card class="centercard">
|
||||||
<h3>The Zcash Register</h3>
|
<h3>The Zcash Register</h3>
|
||||||
<div>
|
|
||||||
<button style="font-size: 10px;" (click)="changeLanguage()">Switch Language</button>
|
|
||||||
</div>
|
|
||||||
<mat-vertical-stepper #stepper linear>
|
<mat-vertical-stepper #stepper linear>
|
||||||
<mat-step label= "{{ vE.loginConnectToZGo }}" editable="false">
|
<mat-step label= "{{ vE.loginConnectToZGo }}" editable="false">
|
||||||
<div align="center" id="info">
|
<div align="center" id="info">
|
||||||
|
|
|
@ -79,8 +79,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
private UserSub: Subscription = new Subscription();
|
private UserSub: Subscription = new Subscription();
|
||||||
public heightUpdate: Observable<number>;
|
public heightUpdate: Observable<number>;
|
||||||
public uZaddrUpdate: Observable<string>;
|
public uZaddrUpdate: Observable<string>;
|
||||||
public userUpdate:Observable<User>;
|
public userUpdate: Observable<User>;
|
||||||
public ownerUpdate:Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
public txsUpdate: Observable<Tx[]>;
|
public txsUpdate: Observable<Tx[]>;
|
||||||
prompt: boolean = false;
|
prompt: boolean = false;
|
||||||
confirmedMemo: boolean = false;
|
confirmedMemo: boolean = false;
|
||||||
|
@ -93,16 +93,18 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
entryForm: UntypedFormGroup;
|
entryForm: UntypedFormGroup;
|
||||||
pinForm: UntypedFormGroup;
|
pinForm: UntypedFormGroup;
|
||||||
|
|
||||||
public vE = {
|
//
|
||||||
|
// Language Support
|
||||||
|
//
|
||||||
|
vE = {
|
||||||
loginConfirmLogin : '',
|
loginConfirmLogin : '',
|
||||||
loginConnectToZGo : '',
|
loginConnectToZGo : '',
|
||||||
loginEnterPin : '',
|
loginEnterPin : '',
|
||||||
loginLastBlock : '',
|
loginLastBlock : '',
|
||||||
loginLinkWallet : ''
|
loginLinkWallet : ''
|
||||||
}
|
}
|
||||||
|
//
|
||||||
public zgoLanguage: string = 'en-US';
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private fb: UntypedFormBuilder,
|
private fb: UntypedFormBuilder,
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
|
@ -113,6 +115,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private languageService: LanguageService
|
private languageService: LanguageService
|
||||||
){
|
){
|
||||||
|
|
||||||
//this.fullnodeService.getAddr();
|
//this.fullnodeService.getAddr();
|
||||||
this.entryForm = fb.group({
|
this.entryForm = fb.group({
|
||||||
selectedSession: [0.001, Validators.required]
|
selectedSession: [0.001, Validators.required]
|
||||||
|
@ -157,24 +160,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
|
this.chgUILanguage();
|
||||||
this.languageService.getViewElements('login', this.zgoLanguage).subscribe(
|
|
||||||
response => {
|
|
||||||
console.log('Received >> ', response );
|
|
||||||
console.log('Language Code : ', response.language);
|
|
||||||
console.log('Component Name : ',response.component);
|
|
||||||
console.log('Language data : ',response.data);
|
|
||||||
console.log('Login_Last_Block -> ',response.data.login_last_block);
|
|
||||||
|
|
||||||
this.vE.loginLastBlock = response.data.login_last_block;
|
|
||||||
this.vE.loginConnectToZGo = response.data.login_connect_to_zgo;
|
|
||||||
this.vE.loginLinkWallet = response.data.login_link_wallet;
|
|
||||||
this.vE.loginConfirmLogin = response.data.login_confirm_login;
|
|
||||||
this.vE.loginEnterPin = response.data.login_enter_pin;
|
|
||||||
},
|
|
||||||
error => { console.log('Error >> ',error); }
|
|
||||||
);
|
|
||||||
|
|
||||||
this.intervalHolder = setInterval(() => {
|
this.intervalHolder = setInterval(() => {
|
||||||
this.fullnodeService.getHeight();
|
this.fullnodeService.getHeight();
|
||||||
//this.userService.findUser();
|
//this.userService.findUser();
|
||||||
|
@ -247,27 +233,23 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
clearInterval(this.intervalHolder);
|
clearInterval(this.intervalHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeLanguage(){
|
chgUILanguage(){
|
||||||
if ( this.zgoLanguage == 'en-US' ) {
|
console.log('LOGIN.chgUILanguage Called ');
|
||||||
this.zgoLanguage = 'es-US';
|
this.languageService.getViewElements('login').subscribe(
|
||||||
} else {
|
response => {
|
||||||
this.zgoLanguage = 'en-US';
|
console.log('Received >> ', response );
|
||||||
}
|
console.log('Language Code : ', response.language);
|
||||||
this.languageService.getViewElements('login', this.zgoLanguage).subscribe(
|
console.log('Component Name : ',response.component);
|
||||||
response => {
|
console.log('Language data : ',response.data);
|
||||||
console.log('Received >> ', response );
|
console.log('Login_Last_Block -> ',response.data.login_last_block);
|
||||||
console.log('Language Code : ', response.language);
|
|
||||||
console.log('Component Name : ',response.component);
|
|
||||||
console.log('Language data : ',response.data);
|
|
||||||
console.log('Login_Last_Block -> ',response.data.login_last_block);
|
|
||||||
|
|
||||||
this.vE.loginLastBlock = response.data.login_last_block;
|
this.vE.loginLastBlock = response.data.login_last_block;
|
||||||
this.vE.loginConnectToZGo = response.data.login_connect_to_zgo;
|
this.vE.loginConnectToZGo = response.data.login_connect_to_zgo;
|
||||||
this.vE.loginLinkWallet = response.data.login_link_wallet;
|
this.vE.loginLinkWallet = response.data.login_link_wallet;
|
||||||
this.vE.loginConfirmLogin = response.data.login_confirm_login;
|
this.vE.loginConfirmLogin = response.data.login_confirm_login;
|
||||||
this.vE.loginEnterPin = response.data.login_enter_pin;
|
this.vE.loginEnterPin = response.data.login_enter_pin;
|
||||||
},
|
},
|
||||||
error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
src/assets/brazil.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src/assets/flag-spacer.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
src/assets/flag-spacer.xcf
Normal file
BIN
src/assets/spain-flag.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/spain.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
src/assets/united-states.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
src/assets/zgo-language-flags.xcf
Normal file
BIN
src/assets/zgo-spain-flag-default.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/zgo-spain-flag.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/zgo-usa-flag-default.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
src/assets/zgo-usa-flag.png
Normal file
After Width: | Height: | Size: 17 KiB |