1import { Component } from '@angular/core';
2import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
3
4@Component({
5 selector: 'app-root',
6 templateUrl: './app.component.html',
7 styleUrls: ['./app.component.css']
8})
9export class AppComponent {
10
11 textDir: string = 'ltr';
12
13 constructor(private translate: TranslateService) {
14
15//this is to determine the text direction depending on the selected language
16
17 this.translate.onLangChange.subscribe((event: LangChangeEvent) =>
18 {
19 if(event.lang == 'ar')
20 {
21 this.textDir = 'rtl';
22 }
23 else
24 {
25 this.textDir = 'ltr';
26 }
27 });
28 }
29
30
31
32}