Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2018 12:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lydemann/3b918767014858ab778ac71a6b2a64a4 to your computer and use it in GitHub Desktop.
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