Created
September 14, 2018 12:32
-
-
Save lydemann/3b918767014858ab778ac71a6b2a64a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { TranslateService } from '@ngx-translate/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { | |
constructor(translate: TranslateService) { | |
translate.addLangs(['en', 'da']); | |
translate.setDefaultLang('en'); | |
const browserLang = translate.getBrowserLang(); | |
translate.use(browserLang.match(/en|da/) ? browserLang : 'en'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment