1
|
import { Component } from '@angular/core';
|
2
|
import { TranslateService } from '@ngx-translate/core';
|
3
|
|
4
|
@Component({
|
5
|
selector: 'app-root',
|
6
|
templateUrl: './app.component.html',
|
7
|
styleUrls: ['./app.component.css']
|
8
|
})
|
9
|
export class AppComponent {
|
10
|
constructor(translate: TranslateService) {
|
11
|
translate.addLangs(['en', 'de', 'cz']);
|
12
|
translate.setDefaultLang('en');
|
13
|
|
14
|
const browserLang = translate.getBrowserLang();
|
15
|
translate.use(browserLang.match(/en|de|cz/) ? browserLang : 'en');
|
16
|
}
|
17
|
}
|