feat: added languages
This commit is contained in:
@@ -1,45 +1,34 @@
|
||||
import type { OnInit } from '@angular/core';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import type { SafeUrl } from '@angular/platform-browser';
|
||||
import type { IconDefinition } from '@fortawesome/angular-fontawesome';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { faArrowLeft } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import type { Global } from '../../global';
|
||||
import { global } from '../../global';
|
||||
import { FooterComponent } from '../footer/footer.component';
|
||||
import { LanguageService } from '../services/language.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-imprint',
|
||||
standalone: true,
|
||||
imports: [FooterComponent, FaIconComponent, RouterLink],
|
||||
templateUrl: './imprint.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class ImprintComponent implements OnInit {
|
||||
private readonly sanitizer = inject(DomSanitizer);
|
||||
|
||||
protected readonly global: Global = global;
|
||||
protected readonly displayStreet: string = this.normalizeText(global.address.street);
|
||||
protected readonly displayCity: string = this.normalizeText(global.address.city);
|
||||
|
||||
protected contactSafeMail!: SafeUrl;
|
||||
protected abuseSafeMail!: SafeUrl;
|
||||
export class ImprintComponent {
|
||||
private readonly languageService = inject(LanguageService);
|
||||
|
||||
protected readonly content = this.languageService.content;
|
||||
protected readonly global = global;
|
||||
protected readonly faArrowLeft: IconDefinition = faArrowLeft;
|
||||
protected readonly contactMailHref = `mailto:${global.contactMail}`;
|
||||
protected readonly abuseMailHref = `mailto:${global.abuseMail}`;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.contactSafeMail = this.sanitizer.bypassSecurityTrustUrl(`mailto:${global.contactMail}`);
|
||||
this.abuseSafeMail = this.sanitizer.bypassSecurityTrustUrl(`mailto:${this.global.abuseMail}`);
|
||||
}
|
||||
|
||||
private normalizeText(value: string): string {
|
||||
return value
|
||||
.replaceAll('ß', 'ß')
|
||||
.replaceAll('ö', 'ö')
|
||||
.replaceAll('Ä', 'Ä')
|
||||
.replaceAll('ä', 'ä')
|
||||
.replaceAll('Ü', 'Ü')
|
||||
.replaceAll('ü', 'ü');
|
||||
protected bind(text: string): string {
|
||||
return text
|
||||
.replaceAll('{{firstname}}', this.global.firstname)
|
||||
.replaceAll('{{lastname}}', this.global.lastname)
|
||||
.replaceAll('{{contactMail}}', this.global.contactMail)
|
||||
.replaceAll('{{contactPhone}}', this.global.contactPhone);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user