Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2018 12:32
What would you like to do?
import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
export class AppComponent {
constructor(translate: TranslateService) {
translate.addLangs(['en', 'da']);
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