Fixed toggle language text.

This commit is contained in:
Joachim Nielandt 2018-03-25 20:21:34 +02:00
parent 884875ee64
commit 1840873b67
2 changed files with 4 additions and 2 deletions

View File

@ -26,7 +26,7 @@ export class LanguagetoggleComponent implements OnInit {
ngOnInit() { ngOnInit() {
// start listening to the stateservice for language updates // start listening to the stateservice for language updates
this.stateService.getLanguageObservable(this.route).subscribe(val => { this.stateService.getLanguageObservable().subscribe(val => {
console.log('language toggle gets a language update from state service: ' + val); console.log('language toggle gets a language update from state service: ' + val);
this.show = (this.language === val); this.show = (this.language === val);
console.log(' after language update, show: ' + this.show); console.log(' after language update, show: ' + this.show);

View File

@ -81,7 +81,7 @@ export class RootComponent implements OnInit {
// do some translation // do some translation
let language = this.stateService.getLanguage(); let language = this.stateService.getLanguage();
if (s === 'lang') { if (s === 'lang') {
if (language == 'nl') { if (language === 'nl') {
this.mousingOver = 'Taal: Nederlands'; this.mousingOver = 'Taal: Nederlands';
} else if (language = 'en') { } else if (language = 'en') {
this.mousingOver = 'Language: English'; this.mousingOver = 'Language: English';
@ -103,8 +103,10 @@ export class RootComponent implements OnInit {
if (this.stateService.getLanguage() === 'nl') { if (this.stateService.getLanguage() === 'nl') {
console.log(' > toggle switched to en'); console.log(' > toggle switched to en');
this.stateService.setLanguage('en', this.route, this.router); this.stateService.setLanguage('en', this.route, this.router);
this.mouseOver('lang');
} else if (this.stateService.getLanguage() === 'en') { } else if (this.stateService.getLanguage() === 'en') {
this.stateService.setLanguage('nl', this.route, this.router); this.stateService.setLanguage('nl', this.route, this.router);
this.mouseOver('lang');
console.log(' > toggle switched to nl'); console.log(' > toggle switched to nl');
} else { } else {
console.log(' > Could not toggle the language, pirates stole your tongue.'); console.log(' > Could not toggle the language, pirates stole your tongue.');