Get current language with angular-translate

Viewed 83698

Is there a way to get the current used language in a controller (without $translateProvider)?

Couldn't find anything in the $translate service.

9 Answers

translate.currentLang is used to check the current selected language in i18n

Maybe is not related but could be useful. In angular2+ the way to access to the current language is

...
import { TranslateService } from '@ngx-translate/core';

export class MyComponent implements OnInit {
  constructor(private translate: TranslateService) {}

  ngOnInit() {
   translate.use('it');
   const currentLang = this.translate.currentLang;
  }
 }

` import { TranslateService } from '@ngx-translate/core';

export class MyComponent implements OnInit { constructor(private translate: TranslateService) { translate.setDefaultLang('en'); }`

Related