import { Component } from '@angular/core' ; import { TranslateService } from '@rxweb/ngx-translate-extension' ; import { ActivatedRoute , Router } from '@angular/router' ; import { translate } from '@rxweb/translate' ; @ Component ( { templateUrl : './change-language.component.html' , } ) export class ChangeLanguageComponent { activeLanguage : string ; @ translate ( { translationName : 'lazy-load' } ) global : any ; constructor ( public translate , private router , private activatedRoute ) { activatedRoute . params . subscribe ( t => { this . activeLanguage = t [ "languageCode" ] ; } ) ; } changeLanguage ( languageCode ) { this . translate . use ( languageCode ) ; } navigate ( languageCode ) { this . router . navigate ( [ languageCode , "lazy-load" ] ) ; } }