Changed everything to use translate pipeline instead of hardcoded text and added german translations

This commit is contained in:
itzMiney committed 2025-06-11 01:08:36 +02:00
1 parent 5c7f0074f3
commit cfa971f856
33 files changed
+758 -321

No files matched your search

@@ -82,3 +82,33 @@
color: white;
cursor: pointer;
}
.language-switch {
position: absolute;
bottom: 20px;
}
.language-switch button {
padding: 8px 16px;
background: #362e51;
color: #fff;
border: none;
cursor: pointer;
font-family: Roboto, serif;
font-size: 1.2rem;
}
.language-switch button.active {
font-weight: bold;
background: #fff;
color: #000;
}
.language-switch button.en {
margin-left: 8px;
border-radius: 25px 0 0 25px;
}
.language-switch button.de {
border-radius: 0 25px 25px 0;
}
@@ -9,11 +9,15 @@
<div class="full-screen-menu" *ngIf="menuOpen">
<button class="close-icon" (click)="toggleMenu()">✖</button>
<ul>
<li><a [routerLink]="'/'" [class.active]="activeLink === '/'"><i class="fa-solid fa-address-card"></i>&#x2007;About</a></li>
<li><a [routerLink]="'/'" [class.active]="activeLink === '/'"><i class="fa-solid fa-address-card"></i>&#x2007;{{ 'NAV_ABOUT' | translate }}</a></li>
<li><a [routerLink]="'/portfolio'" [class.active]="activeLink === '/portfolio'"><i class="fa-solid fa-image"></i>&#x2007;Portfolio</a></li>
<li><a [routerLink]="'/socials'" [class.active]="activeLink === '/socials'"><i class="fa-solid fa-hashtag"></i>&#x2007;Socials</a></li>
<li><a [routerLink]="'/services'" [class.active]="activeLink === '/services'"><i class="fa-solid fa-money-bill"></i>&#x2007;Services</a></li>
<li><a [routerLink]="'/services'" [class.active]="activeLink === '/services'"><i class="fa-solid fa-money-bill"></i>&#x2007;{{ 'NAV_SERVICES' | translate }}</a></li>
<li><a [routerLink]="'/blog'" [class.active]="activeLink === '/blog'"><i class="fa-solid fa-newspaper"></i>&#x2007;Blog</a></li>
</ul>
<div class="language-switch">
<button (click)="switchLang('en')" [class.active]="currentLang === 'en'" class="en">EN</button>
<button (click)="switchLang('de')" [class.active]="currentLang === 'de'" class="de">DE</button>
</div>
</div>
</div>
@@ -2,24 +2,37 @@ import {Component, OnInit} from '@angular/core';
import {DeviceDetectorService} from 'ngx-device-detector';
import {NgIf} from '@angular/common';
import {NavigationEnd, Router, RouterLink} from '@angular/router';
import {TranslatePipe, TranslateService} from '@ngx-translate/core';
@Component({
selector: 'app-mobile-navbar',
imports: [
RouterLink,
NgIf
NgIf,
TranslatePipe
],
templateUrl: './mobile-navbar.component.html',
styleUrl: './mobile-navbar.component.css'
})
export class MobileNavbarComponent implements OnInit{
currentLang: string;
menuOpen = false;
isMobile: boolean;
activeLink: string = '';
constructor(private router: Router, private deviceService: DeviceDetectorService) {
constructor(
private router: Router,
private deviceService: DeviceDetectorService,
private translate: TranslateService
) {
this.isMobile = this.deviceService.isMobile();
this.currentLang = this.translate.currentLang || this.translate.getDefaultLang() || 'en';
}
switchLang(lang: string) {
this.translate.use(lang);
this.currentLang = lang;
}
toggleMenu() {