2018-06-16 18:05:46 +02:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2018-06-19 16:55:50 +02:00
|
|
|
import { OpenslidesService } from './core/services/openslides.service';
|
2018-06-29 17:24:44 +02:00
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2018-06-13 18:34:10 +02:00
|
|
|
|
|
|
|
@Component({
|
2018-06-19 16:55:50 +02:00
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.css']
|
2018-06-13 18:34:10 +02:00
|
|
|
})
|
2018-06-16 18:05:46 +02:00
|
|
|
export class AppComponent implements OnInit {
|
2018-06-29 17:24:44 +02:00
|
|
|
constructor(private openSlides: OpenslidesService, public translate: TranslateService) {
|
|
|
|
// manually add the supported languages
|
|
|
|
translate.addLangs(['en', 'de', 'fr']);
|
|
|
|
// this language will be used as a fallback when a translation isn't found in the current language
|
|
|
|
translate.setDefaultLang('en');
|
|
|
|
// get the browsers default language
|
|
|
|
const browserLang = translate.getBrowserLang();
|
|
|
|
// try to use the browser language if it is available. If not, uses english.
|
|
|
|
translate.use(translate.getLangs().includes(browserLang) ? browserLang : 'en');
|
|
|
|
}
|
2018-06-16 18:05:46 +02:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.openSlides.bootup();
|
|
|
|
}
|
2018-06-13 18:34:10 +02:00
|
|
|
}
|