diff --git a/src/app/app.component.html b/src/app/app.component.html
index 4b784d6..3062597 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -2,18 +2,18 @@
-
+ class="navbar-brand ms-2"
+ role="button"
+ tabindex="0"
+ (click)="switchLanguage( translate.currentLang === 'pl' ? 'en' : 'pl' )"
+ (keydown)="handleKeyDown($event)">
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 5b76c74..5679d0e 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -14,6 +14,7 @@ export class AppComponent implements OnDestroy {
private langChangeSub!: Subscription;
title = 'Strona';
+
constructor(public translate: TranslateService) {
this.initializeLanguage();
}
@@ -24,12 +25,13 @@ export class AppComponent implements OnDestroy {
this.translate.addLangs(supportedLangs);
- if (savedLang && supportedLangs.includes(savedLang)) {
- this.translate.use(savedLang);
+ if( savedLang && supportedLangs.includes(savedLang) ) {
+ this.switchLanguage(savedLang);
} else {
const browserLang = navigator.language.slice(0, 2);
const defaultLang = supportedLangs.includes(browserLang) ? browserLang : 'pl';
this.translate.setDefaultLang(defaultLang);
+ this.switchLanguage( defaultLang );
}
this.langChangeSub = this.translate.onLangChange.subscribe((event) => {