src/app/app.component.ts
| providers |
TextService
|
| selector | app-root |
| styleUrls | app.component.scss |
| templateUrl | ./app.component.html |
constructor(translate: TranslateService)
|
||||||||
|
Defined in src/app/app.component.ts:12
|
||||||||
|
Parameters :
|
import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { TextService } from './shared';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
providers: [ TextService ]
})
export class AppComponent {
constructor(private translate: TranslateService) {
translate.addLangs(['en', 'fr', 'ur', 'es', 'fa']);
translate.setDefaultLang('en');
const browserLang = translate.getBrowserLang();
translate.use(browserLang.match(/en|fr|ur|es|fa/) ? browserLang : 'en');
}
}
<router-outlet></router-outlet>