Skip to content

Commit

Permalink
refactor: add primelocale loading to app.component,ts (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjakobi authored Sep 24, 2024
1 parent b4bff6f commit 1918c43
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core'
import { TranslateService } from '@ngx-translate/core'
import { UserService } from '@onecx/angular-integration-interface'
import { PrimeNGConfig } from 'primeng/api'
import { merge, mergeMap } from 'rxjs'

@Component({
selector: 'ocx-shell-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'shell';
export class AppComponent implements OnInit {
title = 'shell'

constructor(
private translateService: TranslateService,
private config: PrimeNGConfig,
private userService: UserService
) {}

ngOnInit(): void {
this.userService.lang$.subscribe((lang) => {
this.translateService.use(lang)
})
merge(
this.translateService.onLangChange,
this.translateService.onTranslationChange,
this.translateService.onDefaultLangChange
)
.pipe(mergeMap(() => this.translateService.get('primeng')))
.subscribe((res) => this.config.setTranslation(res))
}
}

0 comments on commit 1918c43

Please sign in to comment.