@ngx-translate/core#LangChangeEvent TypeScript Examples

The following examples show how to use @ngx-translate/core#LangChangeEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: rtl-support.directive.ts    From enterprise-ng-2020-workshop with MIT License 6 votes vote down vote up
ngOnInit() {
    this.subscription = this.translate.onLangChange.subscribe(
      (event: LangChangeEvent) => {
        this.el.nativeElement.style.textAlign =
          event.lang === 'he' ? 'right' : 'left';
        this.el.nativeElement.style.direction =
          event.lang === 'he' ? 'rtl' : 'ltr';
      }
    );
  }
Example #2
Source File: periodic-table.component.ts    From ledge with Mozilla Public License 2.0 6 votes vote down vote up
constructor(
    private http: HttpClient,
    public translate: TranslateService,
    private cd: ChangeDetectorRef
  ) {
    this.currentAtom = null;
    this.currentRowHeader = null;
    this.currentColHeader = null;
    this.atoms = null;
    this.selectCategory = '';
    this.updateCategoriesByLang();

    this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
      this.updateCategoriesByLang();
      this.cd.detectChanges();
    });
  }
Example #3
Source File: side-bar.component.ts    From Smersh with MIT License 5 votes vote down vote up
ngOnInit(): void {
    this.username = new DecodedToken().getDecoded().username;

    this.translate.onLangChange.subscribe(
      (event: LangChangeEvent) => (this.currentLang = event.lang as Language)
    );
  }